Skip to content

Instantly share code, notes, and snippets.

@mavenugo
Created February 16, 2017 10:42
Show Gist options
  • Save mavenugo/16f29f0dcba7a173042587e04005ff39 to your computer and use it in GitHub Desktop.
Save mavenugo/16f29f0dcba7a173042587e04005ff39 to your computer and use it in GitHub Desktop.
Welcome to Docker!
~ $ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
7rfkozi079zk7076v4sku4xv0 ip-172-31-16-185.us-west-2.compute.internal Ready Active
omt4j9vzvc8lj60i15gcwmrlu * ip-172-31-11-252.us-west-2.compute.internal Ready Active Leader
~ $ docker plugin ls
ID NAME DESCRIPTION ENABLED
bf5195ce2777 docker4x/cloudstor:latest cloud storage plugin for Docker true
~ $ docker version
Client:
Version: 1.13.1
API version: 1.26
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 08:47:51 2017
OS/Arch: linux/amd64
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 08:47:51 2017
OS/Arch: linux/amd64
Experimental: true
~ $ docker service create --replicas 5 --name ping1 --mount type=volume,volume-driver=docker4x/cloudstor:latest,source=sharedvol1,destination=/shareddata alpine ping docker.com
siyrh37it8vbk0xc2hmoyl3zl
~ $ docker ps | grep ping
5913d6737a72 alpine@sha256:dfbd4a3a8ebca874ebd2474f044a0b33600d4523d03b0df76e5c5986cb02d7e8 "ping docker.com" 42 seconds ago Up 40 seconds ping1.2.s8jttdo7s7kc9v9vaf376t9ay
ee04f6c52535 alpine@sha256:dfbd4a3a8ebca874ebd2474f044a0b33600d4523d03b0df76e5c5986cb02d7e8 "ping docker.com" 42 seconds ago Up 40 seconds ping1.4.8c5ozgwuvecowqryk7lvvy2ps
e7ea2782e3f4 alpine@sha256:dfbd4a3a8ebca874ebd2474f044a0b33600d4523d03b0df76e5c5986cb02d7e8 "ping docker.com" 42 seconds ago Up 40 seconds ping1.1.t5lcylf4wc4ehpy6htb8uiwsh
~ $ docker exec -it ping1.2.s8jttdo7s7kc9v9vaf376t9ay sh
/ # cd /shareddata/
/shareddata # ls
/shareddata # touch sharedfile
/shareddata # echo 1 > sharedfile
/shareddata # cat sharedfile
1
/shareddata # exit
~ $ docker exec -it ping1.4.8c5ozgwuvecowqryk7lvvy2ps sh
/ # cd /shareddata
/shareddata # cat sharedfile
1
/shareddata # echo 2 > sharedfile
/shareddata # exit
~ $ docker exec -it ping1.2.s8jttdo7s7kc9v9vaf376t9ay sh
/ # cat /shareddata/sharedfile
2
/ # exit
~ $ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
7rfkozi079zk7076v4sku4xv0 ip-172-31-16-185.us-west-2.compute.internal Ready Active
lgegmqpazkbl1nyzni7ac7wpb ip-172-31-39-251.us-west-2.compute.internal Down Active
omt4j9vzvc8lj60i15gcwmrlu * ip-172-31-11-252.us-west-2.compute.internal Ready Active Leader
~ $ ssh ip-172-31-16-185.us-west-2.compute.internal
The authenticity of host 'ip-172-31-16-185.us-west-2.compute.internal (172.31.16.185)' can't be established.
ECDSA key fingerprint is SHA256:fQrmDa7SwAowPT+jDet59ao5dIdd4vJnBC0MiDtSiJo.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ip-172-31-16-185.us-west-2.compute.internal,172.31.16.185' (ECDSA) to the list of known hosts.
Welcome to Docker!
~ $ docker ps | grep ping
4741e8a8e31c alpine@sha256:dfbd4a3a8ebca874ebd2474f044a0b33600d4523d03b0df76e5c5986cb02d7e8 "ping docker.com" 2 minutes ago Up 2 minutes ping1.5.lwrkbzoj3gmisqk6of8zftcjl
e5d3716a70fe alpine@sha256:dfbd4a3a8ebca874ebd2474f044a0b33600d4523d03b0df76e5c5986cb02d7e8 "ping docker.com" 2 minutes ago Up 2 minutes ping1.3.xtxfa52ko2l5b2aocma95lkg9
~ $ docker exec -it ping1.3.xtxfa52ko2l5b2aocma95lkg9 sh
/ # cat /shareddata/sharedfile
2
/ # echo 3 > /shareddata/sharedfile
/ # exit
~ $ exit
Connection to ip-172-31-16-185.us-west-2.compute.internal closed.
~ $ docker exec -it ping1.2.s8jttdo7s7kc9v9vaf376t9ay sh
/ # cat /shareddata/sharedfile
3
/ # exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment