Docker series builds a graphical Docker management interface based on portainer
本文最后更新于 362 天前,其中的信息可能已经有所发展或是发生改变,如有失效可到评论区留言。

Preface

Usually when we build docker, whether we usedocker runCommand ordocker-composeCommands are all completed in the terminal using commands. When you need to check the status of various dockers, although you can still use commands to complete it, it is generally not very intuitive.

Although there are corresponding Docker Desktops that can be installed under Windows, Mac, and Linux, unless you usually use it as a desktop terminal, it is quite inconvenient to have to use a remote desktop connection in order to use the GUI interface management. So what we need is a graphical interface that can be managed directly with a browser, which is what this article will introduce: portainer.

Portainer is an open source container management platform that provides an intuitive and easy-to-use web interface to help users manage Docker container clusters, images, volumes and other resources. Portainer supports a variety of Docker environments, including local Docker, Swarm mode, Kubernetes, etc., and supports multi-tenancy, RBAC permission management and other functions. Using Portainer, you can easily create, start, stop, and delete containers, manage the container's network, volume, environment variables and other settings, view container logs, statistics, etc. In addition, Portainer also provides some practical functions, such as container templates, custom dashboards, event monitoring, web terminals, etc.

Deploy portainer

The command is as follows:

docker run --name=portainer -d --restart=always \ -p 9000:9000 \ -v /run/docker.sock:/var/run/docker.sock:ro \ -v /docker/portainer/data: /data \ --workdir=/ --runtime=runc \ portainer/portainer-ce:latest

Parameter explanation:
-p 9000:9000
Map the host's port 9000 to the container's port 9000. You can adjust this according to the actual situation.
-v /run/docker.sock:/var/run/docker.sock:ro
/run/docker.sock is the Unix domain socket that the Docker daemon listens to by default. This parameter maps the host's docker.sock into portainer. Portainer can communicate with the host's Docker daemon through it to manage other containers.
--workdir=/ --runtime=runc \
Specifying the working directory and runtime

Interface Introduction

Use http://host IP:9000 to log in to portainer. You need to create an administrator account for the first login:

image.png

After creation, enter the system and the interface is as follows:
image.png

Portainer can manage multiple environments. You can manage docker on other machines or manage swarm and k8s clusters through "Add Environments" on the right side of the above picture. This time we only manage locally, so click "Get Started" on the left to enter the local page:
image.png

Click "Live connect" in the red box on the right side of the picture above to enter the dashboard:
image.png

Stacks is a collection of containers I created using the docker compose command:
image.png

I have 2 of them here because I only used the docker compose command twice, one is Changting Lei Chi's waf, and the other is umami traffic monitoring.
Images contains all downloaded images, Netowrks contains all created networks, I will not go into detail about these two, and then the most important Containers interface is:
image.png

Compared with Docker Desktop, the biggest advantage of Portainer is what you can do after clicking into a specific Docker. For example, I click into the first bind9:
image.png

Then continue to click "Duplicate/Edit" in the red box above, and you can modify the parameters of the container. There are two main parts:
Network ports configuration, you can add, delete or modify mapped ports:
image.png

Advanced container settings, you can directly modify the environment parameters:
image.png

After the modification is completed, click the button in the red box in the above picture to redeploy the container (in fact, it means deleting the container and then creating a new container with the parameters you configured).

Actually, how useful is this feature? Actually, it is not very useful. Even without this feature, you can manually delete the container and re-run docker run with new parameters. However, if it is not convenient to manage through ssh and only the web is available, this feature will be useful.

Configuring public network access

If you want to publish to the public Internet, you need to choose the most suitable publishing method according to the actual environment and the reverse proxy you use. You can refer to my previous articles:
1,Docker series uses Docker to build its own reverse proxy based on NPM
2,Linux panel series configure reverse proxy and use non-443 port for publishing
3.Home data center series uses domestic cloud hosting to get free cloudflare to achieve fast access to domestic sites from abroad
4.Home Data Center Series: Use cloudflare to build a website quickly with no public IP in your home broadband (general purpose)

The first and second methods are suitable for environments with public IP but no legal 443 port (home broadband, unregistered cloud host). You need to add a non-standard port after the URL (if you use cloudflare to build a website, you don't need to add a port, but you need to customize the source station port. You can refer to:Home data center series uses cloudflare's Origin Rules to solve the problem of having a public IP but no legal ports 80 and 443 when building a websiteThe third method is suitable for cloud hosts with a record, and the fourth method is suitable for all environments (including environments without public IP), which is also the method I recommend (regardless of whether your environment has a public IP or not, because this method does not require running https traffic directly on the public network).

The content of the blog is original. Please indicate the source when reprinting! For more blog articles, you can go toSitemapUnderstand. The RSS address of the blog is:https://blog.tangwudi.com/feed, welcome to subscribe; if necessary, you can joinTelegram GroupDiscuss the problem together.
No Comments

Send Comment Edit Comment


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠(ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ°Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
Emoticons
Emoji
Little Dinosaur
flower!
Previous
Next
       
error:
en_US
Spring Festival
hapiness