Last active
May 25, 2018 11:00
-
-
Save NSLog0/3693d7663e3a572c1669b4169f20c697 to your computer and use it in GitHub Desktop.
on my blog
This file contains hidden or 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
$ docker service ps mysite | |
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR | |
ad0lvaxnsbgcirz5botfle2k3 mysite.1 wordpress ubuntu-node01 Running Running 7 minutes ago | |
3w6vx7b5kbykgmnpl4n3xgz95 mysite.2 wordpress ubuntu-node02 Running Running less than a second ago | |
btjrw6f33rud9vh6wa4pinzhj mysite.3 wordpress ubuntu-node03 Running Preparing 28 seconds ago | |
ab1p9p075zvwlb3t1g5f1n8ww mysite.4 wordpress ubuntu-node04 Running Preparing 28 seconds ago |
This file contains hidden or 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
$ docker service ps mydb | |
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR | |
8iimmrdw760qqubtxmpohc5fj mydb.1 mariadb ubuntu-node01 Running Running 9 minutes ago | |
1nm8mky6cfpufpsm1t8qgvh26 mydb.2 mariadb ubuntu-node03 Running Preparing 5 seconds ago | |
8a96zuu2yycyzt8nta50dvycq mydb.3 mariadb ubuntu-node04 Running Preparing 5 seconds ago | |
co86xfatw4w4sxw5wndu8fqys mydb.4 mariadb ubuntu-node02 Running Preparing 5 seconds ago |
This file contains hidden or 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
$ docker service scale mysite=4 | |
mysite scaled to 4 |
This file contains hidden or 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
$ docker service scale mydb=4 | |
mydb scaled to 4 |
This file contains hidden or 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
$ wget -qO- https://get.docker.com/ | sh |
This file contains hidden or 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
$ docker service create --name mysite --replicas 1 -e WORDPRESS_DB_HOST=mydb -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_NAME=wordpress -e WORDPRESS_DB_PASSWORD=pass --publish 3000:80 --network mynetwork wordpress |
This file contains hidden or 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
$ docker service inspect mysite --pretty | |
ID: 3qlp1fwdok4r5uuisomww479k | |
Name: mysite | |
Mode: Replicated | |
Replicas: 4 | |
Placement: | |
UpdateConfig: | |
Parallelism: 1 | |
On failure: pause | |
ContainerSpec: | |
Image: wordpress | |
Env: WORDPRESS_DB_HOST=mydb WORDPRESS_DB_USER=root WORDPRESS_DB_PASSWORD=pass WORDPRESS_DB_NAME=wordpress | |
Resources: | |
Networks: 4x4azckz8twapbx8b1esopiydPorts: | |
Protocol = tcp | |
TargetPort = 80 | |
PublishedPort = 3000 |
This file contains hidden or 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
$ docker service inspect mydb --pretty | |
ID: e5yaptpqqxmiz9hc96y53snoe | |
Name: mydb | |
Mode: Replicated | |
Replicas: 4 | |
Placement: | |
UpdateConfig: | |
Parallelism: 1 | |
On failure: pause | |
ContainerSpec: | |
Image: mariadb | |
Env: MYSQL_ROOT_PASSWORD=pass MYSQL_DATABASE=wordpress MYSQL_USER=root | |
Resources: | |
Networks: 4x4azckz8twapbx8b1esopiydroot@ubuntu-node01:~# |
This file contains hidden or 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
$ docker service create --replicas 1 --name mydb -e MYSQL_ROOT_PASSWORD=pass -e MYSQL_DATABASE=wordpress -e MYSQL_USER=root --network mynetwork mariadb |
This file contains hidden or 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
$ docker network create -d overlay mynetwork |
This file contains hidden or 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
$ docker node ls | |
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS | |
62e1bpv72cp9f8owhsu980bg7 ubuntu-node03 Ready Active | |
6ivqei97o3azdf9rbdgycz41y * ubuntu-node01 Ready Active Leader | |
7w9yhrb8v7wpylv6bd2igpxvh ubuntu-node04 Ready Active | |
bi1upfxlk6ropt5zr4uoas23n ubuntu-node02 Ready Active |
This file contains hidden or 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
$ docker rm -f mydb.1.ctwsgc5hfxghacsqefvmzdgbk |
This file contains hidden or 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
$ docker service ls | |
ID NAME REPLICAS IMAGE COMMAND | |
3qlp1fwdok4r mysite 4/4 wordpress | |
e5yaptpqqxmi mydb 3/4 mariadb |
This file contains hidden or 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
$ docker service ls | |
ID NAME REPLICAS IMAGE COMMAND | |
3qlp1fwdok4r mysite 4/4 wordpress | |
e5yaptpqqxmi mydb 4/4 mariadb |
This file contains hidden or 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
$ docker service ls | |
ID NAME REPLICAS IMAGE COMMAND | |
c714s8dp59mf mydb 1/1 mariadb |
This file contains hidden or 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
$ docker swarm leave |
This file contains hidden or 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
$ docker service rm [serivce-name] |
This file contains hidden or 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
$ docker swarm join \ | |
--token SWMTKN-1-5fp1c2qqxefo56teko5qbi2dapep57lavgzyk6zmzamf3mi3zq-2qe45xp7dszkrf8tnzawenf90 \ | |
10.130.29.176:237 |
This file contains hidden or 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
$ docker swarm init --advertise-addr 10.130.29.176 |
This file contains hidden or 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
Swarm initialized: current node (6ivqei97o3azdf9rbdgycz41y) is now a manager. | |
To add a worker to this swarm, run the following command: | |
docker swarm join \ | |
--token SWMTKN-1-5fp1c2qqxefo56teko5qbi2dapep57lavgzyk6zmzamf3mi3zq-2qe45xp7dszkrf8tnzawenf90 \ | |
10.130.29.176:2377 | |
To add a manager to this swarm, run the following command: | |
docker swarm join \ | |
--token SWMTKN-1-5fp1c2qqxefo56teko5qbi2dapep57lavgzyk6zmzamf3mi3zq-32c5sng4n2wtl8g7a03ddf1bo \ | |
10.130.29.176:2377 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment