Created
August 8, 2014 21:06
-
-
Save joshuacalloway/5c02daaeac092d7d1a0d to your computer and use it in GitHub Desktop.
Using --volumes-from does not work when using the -H flag. Trying to spin off docker containers on host from within a docker container.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ubuntu:14.04 | |
run apt-get update | |
run apt-get install -y docker.io | |
run ln -sf /usr/bin/docker.io /usr/local/bin/docker | |
add run.sh /usr/local/bin/run | |
entrypoint ["/usr/local/bin/run"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from busybox | |
VOLUME /data | |
ADD hello.txt /data/hello.txt | |
CMD true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "in run.sh entry" | |
ACTION=${1:-} | |
TAG=${TAG:-latest} | |
env=test | |
if [ ! -e "/docker.sock" ] ; then | |
echo "You must map your Docker socket to /docker.sock (i.e. -v /var/run/docker.sock:/docker.sock)" | |
exit 2 | |
fi |
Intro:
So I took a look at shipyard docker. And one thing caught my eye. You can spin off docker containers on the host machine within a docker container.
This is done by using the -H flag.
This all works fine. And this is how shipyard can spin off 5 containers on your machine ( redis, router, database, load balancer, shipyard )
So I decided to try this to deploy our apps as this would make deployment tons easier ( versus knowing systemd, init.d, or the various start scripts of various linux boxes ).
I was able to get about 70% there, but the thing that broke was --volumes-from tag.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you run these commands on host. it works fine.
docker run --name data joshuacalloway/data
docker run --volumes-from data ubuntu cat /data/hello.txt
However if you do this in a container. It is broken.
docker run -it --entrypoint=/bin/bash -v /var/run/docker.sock:/var/run/docker.sock joshuacalloway/deploy -s
xab> docker ps -----> this shows docker processes on the host
xab> docker rm data ---> this removes docker container data that was created above
xab> docker run --name data joshuacalloway/data
xab> docker run --volumes-from data ubuntu cat /data/hello.txt
Here is the gist for the simple example I created.