I need to share local folders as volumes into some containers of a docker-compose.
I don't want docker-compose to be a dependency of my project, but docker only. So I want to use docker-compose in docker.
Using the volumes
instruction into my docker-compose.yml
file work only when I run it with docker-compose directly, but not with docker-compose in docker.
The output with docker-compose is :
$ ./runDockerCompose
Starting want-config-container
Attaching to want-config-container
want-config-container | /config-absolute
want-config-container | /config-relative
want-config-container | /config-relative/two
want-config-container | /config-relative/two/file
want-config-container | /config-relative/one
want-config-container | /config-relative/one/file
The output with docker-compose in docker is :
$ ./runDockerComposeInDocker.sh
Recreating want-config-container
Attaching to want-config-container
want-config-container | /config-absolute
want-config-container | /config-relative
So, how can I get my shared-config folder mounted into my want-config-container ?
I have try to make a container dedicated to hold my config.
I run it with my local config folder as a volume, then make my docker-compose containers linked to it. But it's impossible as I can't use volumes_from
against a external_links
container.
Make the volumes
using an absolute path from the host:
$ ./runDockerComposeInDockerWithAbsolutePath.sh
Recreating want-config-container
Attaching to want-config-container
want-config-container | /config-absolute-from-host
want-config-container | /config-absolute-from-host/two
want-config-container | /config-absolute-from-host/two/file
want-config-container | /config-absolute-from-host/one
want-config-container | /config-absolute-from-host/one/file