Docker集群
admin 发布于:2019-1-30 15:28 分类:系统架构 有 2368 人浏览,获得评论 0 条 标签: Docker
[root@localhost docker]# docker swarm init Swarm initialized: current node (vgc6172h94lo7vktpxs9hnb1y) is now a manager. To add a worker to this swarm, run the following command: docker swarm join \ --token SWMTKN-1-0dpoajwlnlig2pvbujiqzogodwilx6fezg7rgpjfsvob49vnzl-1lq8jjz0hqvcmd2ay91ornac6 \ 192.168.100.136:2377 To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions. [root@localhost docker]# docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS vgc6172h94lo7vktpxs9hnb1y * localhost.localdomain Ready Active Leader [root@localhost docker]# docker service create --name nginx --publish 80:80 --replicas 3 docker.io/idiswy/lnmp td9afve2mqcs4l6t0w4dro8ve [root@localhost docker]# docker service ls ID NAME MODE REPLICAS IMAGE td9afve2mqcs nginx replicated 3/3 docker.io/idiswy/lnmp:latest [root@localhost docker]# docker service ps nginx ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS tnwlid5v447j nginx.1 docker.io/idiswy/lnmp:latest localhost.localdomain Running Running about a minute ago f1h4cenjlj06 nginx.2 docker.io/idiswy/lnmp:latest localhost.localdomain Running Running about a minute ago k6m7nqosffna nginx.3 docker.io/idiswy/lnmp:latest localhost.localdomain Running Running about a minute ago [root@localhost docker]# docker service scale nginx=6 nginx scaled to 6 [root@localhost docker]# docker service ps nginx ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS tnwlid5v447j nginx.1 docker.io/idiswy/lnmp:latest localhost.localdomain Running Running 2 minutes ago f1h4cenjlj06 nginx.2 docker.io/idiswy/lnmp:latest localhost.localdomain Running Running 2 minutes ago k6m7nqosffna nginx.3 docker.io/idiswy/lnmp:latest localhost.localdomain Running Running 2 minutes ago mxx8konbil7u nginx.4 docker.io/idiswy/lnmp:latest localhost.localdomain Running Running 20 seconds ago v6hw4wkm1mf5 nginx.5 docker.io/idiswy/lnmp:latest localhost.localdomain Running Running 20 seconds ago 7mjvtqhxdiqm nginx.6 docker.io/idiswy/lnmp:latest localhost.localdomain Running Running 20 seconds ago [root@localhost docker]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 25eb9d5a1a49 docker.io/idiswy/lnmp@sha256:ddb256e6834e5bd0dbaa0d9130ff94312ecdb1ae19669cc747e99620c4edd656 "/sbin/my_init" About a minute ago Up About a minute 80/tcp, 443/tcp nginx.5.v6hw4wkm1mf5cjvf82vet2f4w 0a1654460e59 docker.io/idiswy/lnmp@sha256:ddb256e6834e5bd0dbaa0d9130ff94312ecdb1ae19669cc747e99620c4edd656 "/sbin/my_init" About a minute ago Up About a minute 80/tcp, 443/tcp nginx.6.7mjvtqhxdiqm3bxwqmeepo0sh ecba5be3df16 docker.io/idiswy/lnmp@sha256:ddb256e6834e5bd0dbaa0d9130ff94312ecdb1ae19669cc747e99620c4edd656 "/sbin/my_init" About a minute ago Up About a minute 80/tcp, 443/tcp nginx.4.mxx8konbil7uq0c9kydos5hei 148735b9e91b docker.io/idiswy/lnmp@sha256:ddb256e6834e5bd0dbaa0d9130ff94312ecdb1ae19669cc747e99620c4edd656 "/sbin/my_init" 3 minutes ago Up 3 minutes 80/tcp, 443/tcp nginx.2.f1h4cenjlj064nfmkyddufze0 dafd4c20c955 docker.io/idiswy/lnmp@sha256:ddb256e6834e5bd0dbaa0d9130ff94312ecdb1ae19669cc747e99620c4edd656 "/sbin/my_init" 3 minutes ago Up 3 minutes 80/tcp, 443/tcp nginx.3.k6m7nqosffnayodp1qjph7o02 020f1099d809 docker.io/idiswy/lnmp@sha256:ddb256e6834e5bd0dbaa0d9130ff94312ecdb1ae19669cc747e99620c4edd656 "/sbin/my_init" 3 minutes ago Up 3 minutes 80/tcp, 443/tcp nginx.1.tnwlid5v447jl61kh8ukg8eob
下一篇:CentOS构建Docker2