codechef
codechef

Reputation: 85

Copy nginx.conf file into the container when container is launched

I have nginx.conf file on our artifactory (http://artifactory.abc.com). I want to dowload and replace the file (/etc/nginx/nginx.conf) inside the container when the container is launched so that I do not have to rebuild the Dockerfile each time I make a change to my nginx.conf file. I can just upload the modified file to artifactory so how can I configure Dockerfile to do the same?

Upvotes: 2

Views: 1787

Answers (2)

Nobita
Nobita

Reputation: 708

You can do a normal docker copy command after downloading file in your local

docker cp nginx.conf <container name/id>:/etc/nginx/nginx.conf

Upvotes: 2

Yuankun
Yuankun

Reputation: 7803

Use a read-only bind mount when running your container:

docker run --mount type=bind,source=/etc/nginx/nginx.conf,target=/etc/nginx/nginx.conf,readonly ...

Upvotes: 0

Related Questions