I'm using docker-compose for start dockers. I have image, which have default config inside, but I want to provide my own config based on default by volumes. So I need to get a default, and have able to change it. When I write volumes like this volumes: - config.json:/etc/config.json
it will create a folder config.json
on host. How I should do this config?
I do it like this when my config.json file is in the same folder than my docker-compose file. volumes: - ${PWD}/config.json:/etc/config.json
I noticed that if I use ./config.json it will create a folder named config.json, so I used ${PWD} instead.
On your first run, to get the default config from the etc folder. You can mount the entire etc folder. So all the files in the etc folder will be available in your local machine.
volumes:
- ./localetc:/etc
Now a new folder called localetc
will be created in your current directory.
Then cd localetc && ls -la
. Now you can see your config.json
file
You can edit your config.json
with your custom configuration and restart the containers by issuing docker-compose restart
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.