Contents
First, install the docker or docker-ce;
Second, set the listening port of 2375;
Third, download portainer image;
Fourth, the initialization Swarm;
V. landing and registered users;
VI, add nodes;
the body of
a mounting docker or docker- CE
. 1, the installation dependencies
#yum the install yum-utils -Y-persistent-Device-Mapper Data Completion LVM2 the bash-
2, was added depot source information
# yum-config-Manager---add the repo HTTP: //mirrors.aliyun .com / docker-ce / Linux / CentOS / Docker-ce.repo
3, warehouse source cache update and install the latest stable version of docker-ce
# yum makecache All
# yum -y install docker-ce docker-ce-SELinux
4, acceleration and mirror drive configuration log
#vi /etc/docker/daemon.json
{
"Registry-mirrors": [ " https://yeuphhaz.mirror.aliyuncs.com "]
}
II set the listening port to 2375
/usr/lib/systemd/system/docker.service #vi
ExecStart = / usr / bin / dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
-H FD: // --containerd = / RUN / containerd / containerd.sock
NOTE: If only the native (IP as 192.168.8.130) use can be -H tcp: //0.0.0.0: 2375 amended as -H tcp: //192.168.8.130: 2375
to restart the docker services
#systemctl-daemon reload
#systemctl restart docker
Third, download portainer mirror ;
#mkdir -p / Docker / portainer_data
#cd / Docker
#docker Create Volume portainer_data
#docker pull portainer / portainer: 1.21.0
#docker -d -p 9000 RUN: 9000 --name portainer --restart Always -v / var /run/docker.sock:/var/run/docker.sock -v portainer_data: / data portainer / portainer: 1.21.0
Fourth, initialize the Swarm
#docker Swarm --advertise the init-addr 192.168.8.130
After the command is executed, the machine automatically added to the swarm cluster. This will create a cluster token, the only access to global token, as a cluster unique identification. Follow the other node joins the cluster will use this token value.
Fifth, a registered user login and
if clustered select [Remote] option, enter a custom name Name and IP address information URL Endpoint URL in the Environment content, such as 192.168.8.130:2375. Note that the machine is to open port 2375 firewall access.
If the machine is used to directly select [Local], you do not need to enter a custom name information corresponding Endpoint URL
Sixth, add nodes
executed on other machines the following command (only need to use to build a cluster)
#docker the Join the Swarm --token SWMTKN-1-2k5odts5j9ackj013kq03qo9p3cps98b9w28p2rztohjvkkj1c-ar8a1tkq4niopb1o6ophc152a 192.168.8.130:2377
above code to be generated with exactly the same token initialization, when the command is not clear, it can be viewed by docker swarm join-token worker command on the deployment manager.
Endpoints can add nodes in Docker