And Finally
And Finally

Reputation: 5704

Docker: how to manage development and production settings?

I'm just getting started with Docker. With the official NGINX image on my OSX development machine (with Docker Machine as the Docker host) I ran up against the bug with sendfile and VirtualBox which means the server fails to show changes I make to files.

The workaround for this is to use a modified nginx.conf file that turns off sendfile. This guy's solution has an instruction in the Dockerfile to copy a customised conf file into the container. Alternatively, this guy maps the NGINX configuration to a new folder with modified conf file.

This kind of thing works OK locally. But what if I don't need this modification on my cloud host? How should I handle this and other differences when it comes to deployment?

Upvotes: 12

Views: 4086

Answers (1)

Evgeny Chernyavskiy
Evgeny Chernyavskiy

Reputation: 2634

You could mount your custom nginx.conf into the container in development via e.g. --volume ./nginx/nginx.conf:/etc/nginx/nginx.conf and simply omit this parameter to docker run in production.

If using docker-compose, the two options I would recommend are:

Upvotes: 15

Related Questions