docker文件内容:
2019-02-21
当我执行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)"
时
但我发现它无法正确执行带有a.txt内容的期望脚本:
docker build -t freeradius .
预期结果如下:
root@6384c0a1d92f:/# cat a.txt
spawn openssl pkcs12 -in test.pfx -clcerts -out /etc/freeradius/certs/ecc_radius_cert.pem -nokeys
Enter Import Password:root@6384c0a1d92f:/#