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

docker-compose in docker #42

Closed
tinytelly opened this issue Feb 21, 2017 · 2 comments
Closed

docker-compose in docker #42

tinytelly opened this issue Feb 21, 2017 · 2 comments

Comments

@tinytelly
Copy link

tinytelly commented Feb 21, 2017

I have docker-compose installed on the server like this:

$ docker-compose --version
docker-compose version 1.8.1, build 878cff1
$ which docker-compose
/usr/local/bin/docker-compose

I start my docker container like this:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock myservice:latest

and myservice:lastest is built from

FROM docker:latest

inside the container I call a bash script that does docker things..and all works fine.
I also want to call docker-compose and have it use the docker-compose on the host in the same as docker does.

Not sure how to do this.....any ideas?

Thanks
Matt

@tinytelly
Copy link
Author

figured it out....here's the answer to help anyone that is trying to do the same thing.

Inside the bash script running in the container you run docker-compose as a container rather than try to use the docker-compose on the host.

Like this:
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v /home:/home -w /home docker/compose:1.11.2 -f docker-compose-you-want-to-run.yml up -d --no-recreate

make sure you copy docker-compose-you-want-to-run.yml into /home first.

@tianon
Copy link
Member

tianon commented Jun 1, 2017

Cool, glad you got a good solution worked out! 👍

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

No branches or pull requests

2 participants