Provide GitHub file as default conf file in a docker-compose volume

Viewed 44

So my question is whether it is possible to have a volume like:

"${my_conf_file}:-raw.my/GitHub/file.git":/conf.json

So this would be my goal, however I do not find anything related to this. In the end if the user has a file, the file should be passed, otherwise either conf.json should not be replaced by anything (because the GitHub file is already there, to be replaced by a conf file that a user might have) or the file from GitHub should be passed again.

1 Answers

If it best to figure out the first part ("${my_conf_file}:-raw.my/GitHub/file.git") ahead of the docker run.

In your start script (which calls docker run or uses your docker-compose.yml), add a script able to determine which config file you want (the user's, conf.json itself or the one from GitHub)

Once you can script that, then you can add your docker run -v call, which will mount the right file to :/conf.json in the container.

Related