docker swarn集群笔记

时间:2022-05-01 01:51:18
.安装Docker 三剑客:
curl -L https://github.com/docker/machine/releases/download/v0.10.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine && chmod +x /tmp/docker-machine && sudo cp /tmp/docker-machine /usr/local/bin/docker-machine yum -y install python-pip
pip install docker-compose [root@localhost webapps]# docker swarm init --advertise-addr 10.60.10.39
Swarm initialized: current node (w45qdtntwrpr97ty8ldtu4sw7) is now a manager. To add a worker to this swarm, run the following command: docker swarm join \
--token SWMTKN--24911fv7pfba7781s1kjg381xhdsgs6amkrsfyiyp9qonhfmuk-0fgnqz2zi5yzwc7gs2d7ktasw \
10.60.10.69: To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions. docker swarm join \
--token SWMTKN--2rpog039x8lrihu3z1vpkaa9ju2klwsyujya7lhlr8gwzw4x1m-2t4e9l2ummijrj0769sk24mwl \
10.60.10.39: docker node ls docker network create --driver overlay doceker_test_net01
docker network ls #所有节点
docker pull nginx docker service create --replicas --name myNgx --network=doceker_test_net01 nginx docker service ps myNgx
docker service ls
docker service scale myNgx= docker service update --image nginx myNgx docker service rm myNgx