我有以下bash脚本命令
read -r -d '' FILECONTENT <<'ENDFILECONTENT'
index index.html;
location ~ /\.ht {
deny all;
}
ENDFILECONTENT
echo "$FILECONTENT" > /etc/nginx/common.conf
如何更改此设置,使其可以在Dockerfile中成功运行?
我试过了
## Common Configuration
run read -r -d '' FILECONTENT <<'ENDFILECONTENT'
index index.html;
location ~ /\.ht {
deny all;
}
ENDFILECONTENT
run echo "$FILECONTENT" > /etc/nginx/common.conf
我这样做时遇到以下错误 docker build -t ubuntu1404/djangoapp .
Step 10 : RUN read -r -d '' FILECONTENT <<'ENDFILECONTENT'
---> Running in 69508c5aaed0
/bin/sh: 1: read: Illegal option -d
INFO[0062] The command [/bin/sh -c read -r -d '' FILECONTENT <<'ENDFILECONTENT'] returned a non-zero code: 2
#docker irc频道中的k10d建议我使用COPY。
这工作
有以下
index index.html;
location ~ /\.ht {
deny all;
}
里面 nginx_configuration/common.conf
nginx_configuration/
是与Dockerfile相邻的文件夹
## copy the nginx config files COPY ./nginx_configuration/common.conf /etc/nginx/common.conf
正常运行dockerfile。
docker build -t ubuntu1404/djangoapp .
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句