call expect script from dockerfile exited unexpectedly

docker file content:

From freeradius/freeradius-server
COPY eccCertImport /
RUN apt-get update -y && apt-get install -y expect
RUN ["/bin/sh","/eccCertImport"]

eccCertImport file content:
#!/bin/bash +x
#!/usr/bin/expect
key_passphrase="test123";
set timeout -1
radius_cert_cmd="openssl pkcs12 -in radius_ecc_pfx -clcerts -out radius_ecc_cer -nokeys"
exp_cmd="spawn $radius_cert_cmd;
         expect "Import Password:"
         send "${key_passphrase}r"
         interact"
result="$(expect -c "$exp_cmd" |  tee -a a.txt)"

when I execute docker build -t freeradius .
but I found it fail to execute expect script correctly with a.txt content:

[email protected]:/# cat a.txt
spawn openssl pkcs12 -in test.pfx -clcerts -out /etc/freeradius/certs/ecc_radius_cert.pem -nokeys
Enter Import Password:[email protected]:/#

Source: StackOverflow