我的entrypoint.sh
看起来像这样:
sed -i 's/HOST_NAME/'"$HOST_NAME"'/g' /usr/local/openresty/nginx/conf/conf.d/CONFIG_FILE.conf
exec "$@"
CONFIG_FILE.conf
就是这样:
upstream gunicorn {
server $HOST_NAME;
}
我的docker run命令如下所示:
docker run -e HOST_NAME=http://cnn.com sid:latest cat /usr/local/openresty/nginx/conf/conf.d/CONFIG_FILE.conf
我正在尝试通过docker run传递cnn.com
来替换$HOST_NAME
中的CONFIG_FILE.conf
。
任何帮助都会受到高度赞赏,我是新手,所以如果我犯了愚蠢的错误,请耐心等待。
感谢。
答案 0 :(得分:0)
您可以使用/
之类的#
以外的其他分隔符:
sed -i 's#$HOST_NAME#'"$HOST_NAME"'#g' /usr/local/openresty/nginx/conf/conf.d/CONFIG_FILE.conf