how to use sed command with docker run to replace text on a .conf file for nginx docker image? -


my entrypoint.sh looks :

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; } 

my docker run command looks :

docker run -e host_name=http://cnn.com sid:latest cat /usr/local/openresty/nginx/conf/conf.d/config_file.conf 

i trying pass cnn.com via docker run replace $host_name in config_file.conf.

any highly appreciated, new this, please bear me if made silly mistakes.

thanks.

you can use other separator / in sed # :

sed -i 's#$host_name#'"$host_name"'#g' /usr/local/openresty/nginx/conf/conf.d/config_file.conf 

Comments