Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change config files with docker assigned volumes? #9

Open
spuder opened this issue Dec 10, 2019 · 1 comment
Open

How to change config files with docker assigned volumes? #9

spuder opened this issue Dec 10, 2019 · 1 comment
Labels

Comments

@spuder
Copy link
Contributor

spuder commented Dec 10, 2019

Thanks for making these docker containers.

What is the recommended practice to change config files? Traditionally I've used the legacy 'bind' mount to point to files on the host managed by puppet.

docker run -it -v /etc/grafana/ldap.toml:/etc/grafana/ldap.toml gographite/go-graphite:1.0.4

However because this container uses the new volumes, I'm not able to use the older bind mounts.

https://docs.docker.com/storage/

If you mount a bind mount or non-empty volume into a directory in the container in which some files or directories exist, these files or directories are obscured by the mount, just as if you saved files into /mnt on a Linux host and then mounted a USB drive into /mnt. The contents of /mnt would be obscured by the contents of the USB drive until the USB drive were unmounted. The obscured files are not removed or altered, but are not accessible while the bind mount or volume is mounted.

Some people suggest using busybox to inject config files

https://stackoverflow.com/questions/37468788/what-is-the-right-way-to-add-data-to-an-existing-named-volume-in-docker

docker run -v my-jenkins-volume:/data --name helper busybox true
docker cp . helper:/data
docker rm helper

This feels unnecessarily complicated.

How do you recommend users change config files inside the docker container?

@deniszh
Copy link
Member

deniszh commented Dec 11, 2019

Hi @spuder ,
Yes, for proper solution we need to support env variables, as Grafana doing that in own image.
But why not copy whole https://github.com/go-graphite/docker-go-graphite/tree/master/conf/etc/grafana to directory, edit files and mount to /etc/grafana ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants