Centos7 Configuring Docker Swarm and Installation Portainer

Source: Internet
Author: User
Tags docker swarm

First, create a cluster

1. Initialize the manager node (XXX is the manager's IP address)

docker swarm init --advertise-addr xxx.xxx.xxx.xxx

Will output the following, note Bold Italic command, join the cluster need to use

Swarm initialized:current Node (pk4p936t4e03cpse3izuws07s) is now a manager.
To add a worker to this swarm, run the following command:
Docker swarm join--token XXX xxx.xxx.xxx.xxx:2377
To add a manager to this swarm, run ' Docker swarm Join-token Manager ' and follow the instructions.

2, the worker joins the cluster, runs the above command on the other Docker server

docker swarm join --token xxx xxx.xxx.xxx.xxx:2377

3. View cluster status

docker node ls

Second, installation Portainer

1. Create a portainer-stack.yml file

version: ‘3‘services:  portainer:    image: portainer/portainer    volumes:      - "/var/run/docker.sock:/var/run/docker.sock"      - "/data/portainer:/data"    deploy:      placement:        constraints: [node.role == manager] # 控制管理界面部署在manager上      replicas: 1      restart_policy:        condition: on-failure      resources:        limits:          cpus: "0.2"          memory: 200M      labels: [svc=portainer]    ports:      - 9000:9000

2. Start Portainer Service

docker stack deploy -c portainer-stack.yml portainer

3, Access Portainer and change the password (XXX for any one of the cluster ip,swarm will automatically do load balancing)

Visit http://xxx.xxx.xxx.xxx:9000

Centos7 Configuring Docker Swarm and Installation Portainer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.