Docker环境下的前后端分离项目部署与运维(十二)使用Portainer管理Docker
安装
docker hub地址:https://hub.docker.com/r/portainer/portainer/
# 每台服务器都要安装
docker pull portainer/portainer
开放Docker网络管理端口
- 修改 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
-
刷新配置文件,重启docker
systemctl daemon-reload systemctl restart docker
- 查看docker进程是否监听
netstat -ano | grep 2375 tcp6 0 0 :::2375 :::* LISTEN off (0.00/0/0)
-
查看系统网络端口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部署方案
用户角度流程
作者:一个大西瓜
-------------------------------------------
个性签名:独学而无友,则孤陋而寡闻。做一个灵魂有趣的人!
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!
万水千山总是情,打赏一分行不行,所以如果你心情还比较高兴,也是可以扫码打赏博主,哈哈哈(っ•̀ω•́)っ✎⁾⁾!