docker deploy portainer

===============================================

 2018/5/1_1st modification ccb_warlock

 

===============================================

After deploying the swarm ( http://www.cnblogs.com/straycats/p/8978135.html ), look for a web system that can manage the swarm for easy management. The portainer can satisfy the basic management of the swarm, and the project is on github There are more collections.

  


1. Prerequisites
- docker, docker-compose, and swarm have been deployed. For deployment, please refer to "Deploying docker Swarm.md"
- Default deployed server IP: 192.168.12.11

 


2. Deploy portainer to manage swarm
2.1 Create a directory

mkdir -p /opt/portainer
mkdir -p /data

 

2.2 Install portainer
2.2.1 Command mode

docker service create \
  --name portainer \
  --publish 9000:9000 \
  --replicas=1 \
  --constraint 'node.role == manager' \
  --mount type=bind,src=//var/run/docker.sock,dst=/var/run/docker.sock \
  --mount type=bind,src=//opt/portainer,dst=/data \
  portainer/portainer \
  -H unix:///var/run/docker.sock
  --restart-condition on-failure

 

2.2.2 stack method
# add portainer-stack.yml

cd /root
vim portainer -stack.yml

 

# Add the following content, wq save

version: '3'
services:

  carry:
    picture: portainer / portainer
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "/opt/portainer:/data"
    deploy:
      placement:
        Constraints: [node.role == manager] #The control management interface is deployed on the manager 
      replicas: 1
      restart_policy:
        condition: on-failure
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      labels: [svc=portainer]
    ports:
      - 9000:9000

 

# Create portainer-stack

cd
docker stack deploy -c portainer-stack.yml portainer-stack

PS. If you need to remove the stack, use the command

docker stack rm portainer-stack

 

2.3 Visit the page
browser to visit https://192.168.12.11:9000 and
fill in a password of 8 or more digits to create an administrator user. After entering the system, you can change the password within 8 digits.


If you use the stack portainer, you also need to choose to manage the local docker environment.


 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325150491&siteId=291194637