obesechicken13
obesechicken13

Reputation: 833

Where are you supposed to store your docker config files?

I'm new to docker so I have a very simple question: Where do you put your config files?

Say you want to install mongodb. You install it but then you need to create/edit a file. I don't think they fit on github since they're used for deployment though it's not a bad place to store the files.

I was just wondering if docker had any support for storing such config files so you can add them as part of running an image.

Do you have to use swarms?

Upvotes: 3

Views: 4947

Answers (2)

C. Tindall
C. Tindall

Reputation: 443

Yes, in most cases you definitely want to keep your Dockerfiles in version control. If your org (or you personally) use GitHub for this, that's fine, but stick them wherever your other repos are. One of the main ideas in DevOps is to treat infrastructure as code. In fact, one of the main benefits of something like a Dockerfile (or a chef cookbook, or a puppet file, etc) is that it is "used for deployment" but can also be version-controlled, meaningfully diffed, etc.

Upvotes: 1

Jordan Parmer
Jordan Parmer

Reputation: 37174

Typically you'll store the configuration files on the Docker host and then use volumes to bind mount your configuration files in the container. This allows you to separately manage the configuration file from the running containers. When you make a change to the configuration, you can just restart the container.

You can then use a configuration management tool like Salt, Puppet, or Chef to manage copying/storing the configuration file onto the Docker host. Things like passwords can be managed by the secrets capabilities of the tool. When set up this way, changing a configuration file just means you need to restart your container and not build a new image.

Upvotes: 3

Related Questions