Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker graphical Management Portainer

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Deploy PORTAINER

Use the official Demo preview.

Address: http://demo.portainer.io/

I. stand-alone deployment of PORTAINER

Use the following Docker command to deploy Portainer:

[root@192 ~] # docker pull portainer/portainer

[root@192 ~] # docker volume create portainer_data

[root@192] # docker run-d-p 9000 var/run/docker.sock:/var/run/docker.sock-v portainer_data:/data portainer/portainer

Note: restart when shutting down the selinux virtual machine, otherwise an error will be reported.

Visit the web page http://IP:9000

II. Deploy in a Swarm cluster

Note:

Add an image accelerator, or you may report an error when downloading the image later.

[root@manager ~] # vim / etc/docker/daemon.json

{

"registry-mirrors": ["https://registry.docker-cn.com"]"

}

Create a cluster and download the basic image. Every node in the cluster must have a portainer/agent image

1. Create a Docker Swarm cluster

[root@manager] # docker swarm init-- advertise-addr 192.168.10.102

[root@localhost ~] # docker pull portainer/agent # # download proxy image

1. Create two networks

[root@localhost] # docker network create-- driver overlay portainer_agent_network

[root@localhost] # docker network create-- driver overlay my-network

○ 22 deploys the agent as a global service in the cluster # # nodes need to be re-portainer/agent

[root@manager] # docker service create-name portainer_agent-network portainer_agent_network-publish mode=host,target=9001,published=9001-e AGENT_CLUSTER_ADDR=tasks.portainer_agent-mode global-mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock portainer/agent

4zmiaajed7c6vc591hcrkkksl

Overall progress: 3 out of 3 tasks

I3i9p03c6zo7: running

Hzorsxqq5l42: running

21hha3mf1sao: running

Verify: Service converged

[root@manager ~] # docker service ps portainer_agent # # View status

ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS

N5smvf1mfs1y portainer_agent.21hha3mf1sao77g07tpxr12lp portainer/agent:latest 192.168.0.122 Running Running 9 minutes ago: 9001-> 9001/tcp

P5h4caz91b1i portainer_agent.i3i9p03c6zo7guhhf31ng0zkd portainer/agent:latest 192.168.0.120 Running Running 9 minutes ago: 9001-> 9001/tcp

87q0pzanti4q portainer_agent.hzorsxqq5l42feix3o23vk7cr portainer/agent:latest 192.168.0.126 Running Running 9 minutes ago *: 9001-> 9001/tcp

3.Portainer instance deployment

○ 3 in the cluster, create a single Portainer visualizer container, default port 9000

[root@localhost] # docker service create-- name portainer-- network portainer_agent_network-- publish 9000 network portainer_agent_network network portainer_agent_network-- replicas=1-- constraint 'node.role = = manager' portainer/portainer-H "tcp://tasks.portainer_agent:9001"-- tlsskipverify

8ymzu530g699lnyj4bzx38me4

Overall progress: 1 out of 1 tasks

1/1: running

Verify: Service converged

Browsers access http://IP:9000

○ 4 create an administrative user

○ 5 add managed nodes

Configure Endpoints Dashboard

Deploy the niigx service in the cluster. And create three copies of the test

[root@localhost] # docker service create-- name ngixn-test02-- network my-network-- publish 8888network my-network 80-- replicas=3 nginx

Image nginx:latest could not be accessed on a registry to record

Its digest. Each node will access nginx:latest independently

Possibly leading to different nodes running different

Versions of the image.

Uuz2q0qdet6sjee8rngi92bju

Overall progress: 3 out of 3 tasks

1/3: running

2/3: running

3/3: running

Verify: Service converged

You can see the details on the web page

View system resources for a single container

Download the image

Create a httpd service based on the downloaded image

When the browser accesses http://IP:90, you can see that the httpd service has been successfully created through Portainer.

7. Create and add private repositories

[root@manager] # docker run-d-v / home/root/registry:/var/lib/registry-p 5000 restart=always-- privileged=true-- name registry registry:latest

A7bf1601c3ebc28e1bff059638f0c9a7f602e525f55b1741f497026a56c33b31

Edit the daemon.json file and change it to a private warehouse address, which should be set on all three hosts.

[root@manager ~] # vim / etc/docker/daemon.json

{

"insecure-registries": ["192.168.10.102 VR 5000"]

}

[root@manager ~] # scp / etc/docker/daemon.json 192.168.10.103:/etc/docker/

[root@manager ~] # scp / etc/docker/daemon.json 192.168.10.104:/etc/docker/

Note: when Docker is restarted on three nodes, the previously created Portainer and portainer_agent services will not function properly.

At this point, you need to delete this service on manager and re-execute ○ 2 Murray-○ 5.

[root@manager ~] # systemctl restart docker # # restart docker on three nodes

[root@manager ~] # docker service rm portainer

Portainer

[root@manager ~] # docker service rm portainer_agent

Portainer_agent

Configure private warehouse

Create a private warehouse

[root@manager ~] # docker pull httpd

Upload the image to a private repository

Mark the mirror image

[root@manager] # docker tag httpd:latest 192.168.10.102:5000/httpd-test:2019-08-25

Upload the image to a private repository

[root@manager] # docker push 192.168.10.102:5000/httpd-test:2019-08-25

The push refers to repository [192.168.10.102:5000/httpd-test] # # Private warehouse

9e0ab3afff15: Pushed

7a0960d9b679: Pushed

8b16516271d6: Pushed

5bcb93651a74: Pushed

1c95c77433e8: Pushed

2019-08-25: digest: sha256:90cca2f9c32ad25afa180da6b14f35de9990cb02b9007350a5bccef4cac1e1c9 size: 1367

Create a service test for httpd (ibid.)

[root@manager] # docker service create-- name httpd-test02-- network my-network-- publish 8888purl 80-- replicas=3 192.168.10.102:5000/httpd-test:2019-08-25

Wc31arswabmodsxhdqojrlvz9

Overall progress: 3 out of 3 tasks

1/3: running

2/3: running

3/3: running

Verify: Service converged

You can see that the task created based on the private repository image has been successfully deployed

Note: when creating containers, change to the address of the private warehouse.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report