I am putting together some tools that need access to config spread across different locations on host machines.
For reasons beyond my control, different hosts have different mappings, so I need the bind mounts to vary.
Is is possible to externalize mount configurations so we can dynamically generate this per host?
I have seen docker-compose examples that use JSON, but can't find any docker run equivalent (docker-compose isn't an option for my use-case).
I have tried the following :
container-env.json:
{
"mounts" : [
"type=bind,source=//c/Users/foo/.ssh,target=/root/.ssh,ro",
"type=bind,source=//c/Users/foo/Projects/ops-tools,target=/root/ops-tools",
"type=bind,source=//c/tmp/certs,target=/root/certs"
]
}
docker run --env-file container-env.json...
however docker complains with error 'poorly formatted environment: variable '"mounts" : [' contains whitespaces.
', removing whitespace suppresses the error but nothing is mounted