Docker環境下的先後端分離項目部署與運維(十二)使用Portainer管理Docker

安裝

docker hub地址:https://hub.docker.com/r/portainer/portainer/docker

# 每臺服務器都要安裝
docker pull portainer/portainer

開放Docker網絡管理端口

  1. 修改 docker.service  修改 [Service]的ExecStart,ExecStart= 必定要加
    cp /usr/lib/systemd/system/docker.service /usr/lib/systemd/system/docker.service.bak
    vim /usr/lib/systemd/system/docker.service
    [Service]
    Type=notify
    # the default is not to use systemd for cgroups because the delegate issues still
    # exists and systemd currently does not support the cgroup feature set required
    # for containers run by docker
    ExecStart=
    ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock

     

  2. 刷新配置文件,重啓dockervim

    systemctl daemon-reload
    systemctl restart docker
  3. 查看docker進程是否監聽
    netstat -ano | grep 2375
    tcp6       0      0 :::2375                 :::*                    LISTEN      off (0.00/0/0)
  4. 查看系統網絡端口2375是否被docker所監聽服務器

    netstat -tulp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
    tcp        0      0 0.0.0.0:ssh             0.0.0.0:*               LISTEN      3124/sshd           
    tcp        0      0 localhost:smtp          0.0.0.0:*               LISTEN      3379/master         
    tcp6       0      0 [::]:2375               [::]:*                  LISTEN      13964/dockerd       

建立Portainer容器

# -- 192.168.103.210
docker volume create --name portainer_v1
docker run -d -p 9000:9000 --restart=always -v portainer_v1:/data portainer/portainer -H tcp://192.168.103.210:2375
# -- 192.168.103.240
docker volume create --name portainer_v1
docker run -d -p 9000:9000 --restart=always -v portainer_v1:/data portainer/portainer -H tcp://192.168.103.240:2375
# -- 192.168.103.212
docker volume create --name portainer_v1
docker run -d -p 9000:9000 --restart=always -v portainer_v1:/data portainer/portainer -H tcp://192.168.103.212:2375
# -- 192.168.103.213
docker volume create --name portainer_v1
docker run -d -p 9000:9000 --restart=always -v portainer_v1:/data portainer/portainer -H tcp://192.168.103.213:2375

 

四臺主機之上PXC部署方案

用戶角度流程

相關文章
相關標籤/搜索