Last active
August 29, 2015 14:07
-
-
Save boutros/27fcb9fcca27b330cc45 to your computer and use it in GitHub Desktop.
Docker data volumes - viser hvordan flere kontainere får tilgang på samme data
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
echo "FROM busybox" > Dockerfile | |
echo 'VOLUME ["/data"]' >> Dockerfile | |
docker build -t data_image . | |
docker run --name data_volume data_image | |
docker run -d --name k1 --volumes-from=data_volume busybox sh -c 'echo "hei" > /data/hilsen.txt; sleep 60' | |
docker run -d --name k2 --volumes-from=data_volume busybox sh -c 'echo "yo!" >> /data/hilsen.txt; sleep 60' | |
docker run --rm --volumes-from=data_volume busybox cat /data/hilsen.txt | |
> hei | |
> yo! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment