Install portainer(docker-ce) and Create Cluster on PVE

安裝Docker-CE

apt-get install  apt-transport-https ca-certificates  curl gnupg2  software-properties-common pve-headers
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -

add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"

apt update && apt install docker-ce

建立叢集:

docker swarm init --advertise-addr 10.0.1.114

會產生類似以下結果:

docker swarm init --advertise-addr 10.0.5.114
Swarm initialized: current node (enyg5rdfpryq7ovbv7ubcxdvb) is now a manager.
To add a worker to this swarm, run the following command:
    docker swarm join --token SWMTKN-1-3zzlzvbvsf2tutrr6fy63gzvdxv9fe387w3xjymbov5xt8gba7-1nr5izgwru2pa2adgbzcdf27q 10.0.5.114:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

加入叢集:

docker swarm join --token <TOKEN> 10.0.1.114:2377

載入portainer:

docker pull portainer/portainer:latest

建立叢集網路:

docker network create --driver overlay portainer_agent_network
39uftp12a2r2h4oxhr0aqwl1x

產生以下結果:

39uftp12a2r2h4oxhr0aqwl1x

建立服務:

docker service create \
--name portainer_agent \
--network portainer_agent_network \
-e AGENT_CLUSTER_ADDR=產生的結果ID \
--mode global \
--mount type=bind,src=//var/run/docker.sock,dst=/var/run/docker.sock \
portainer/agent

建立資料夾:

/root/portainer/data

建立Docker服務:

docker service create \
    --name portainer \
    --network portainer_agent_network \
    --publish 9000:9000 \
    --replicas=1 \
    --constraint 'node.role == manager' \
    --mount type=bind,src=/root/portainer/data,dst=/data \
    portainer/portainer -H "tcp://tasks.portainer_agent:9001" --tlsskipverify

進入管理頁面:

http://<MANAGER-IP>:9000

啟用服務:

systemctl enable docker
systemctl start docker

單機安裝方式:

apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt-get update && apt-get install docker-ce -y

建立資料夾:

mkdir /root/portainer/
mkdir /root/portainer/data

Portainer for a Docker WebGUI:

docker run -d --restart=always -p 9000:9000 -v /root/portainer/data:/data -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer

啟用服務:

sudo systemctl enable docker
systemctl start docker

新面板:Rancher Docker 容器與部署工具

阅读剩余
THE END