Centos7 安装Docker管理工具Portainer

0、前提条件

已安装Docker并且开启Docker,安装Docker可参见:Centos7 安装 Docker_瘦身小蚂蚁的博客-CSDN博客

1、 拉取portainer-ce镜像

docker pull portainer/portainer-ce:latest

[root@localhost ~]# docker pull portainer/portainer-ce:latest
latest: Pulling from portainer/portainer-ce
772227786281: Pull complete 
96fd13befc87: Pull complete 
5171176db7f2: Pull complete 
a143fdc4fa02: Pull complete 
b622730c7bdc: Pull complete 
c1cad9f5200f: Pull complete 
d8a77b01f2cb: Pull complete 
0d4d8543f764: Pull complete 
c6fd0bcf10c9: Pull complete 
889200668c1c: Pull complete 
4f4fb700ef54: Pull complete 
Digest: sha256:94c3056dbe879f3a3df06b427713392a0962924914f5c2fc557de3797f59f926
Status: Downloaded newer image for portainer/portainer-ce:latest
docker.io/portainer/portainer-ce:latest

2、部署portainer-ce

(1)创建容器数据卷

docker volume create portainer_data

[root@localhost ~]# docker volume create portainer_data
portainer_data

 (2)创建portainer-ce容器

docker run -d -p 8000:8000 -p 9000:9000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes/portainer_data:/data portainer/portainer-ce:latest

[root@localhost ~]# docker run -d -p 8000:8000 -p 9000:9000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes/portainer_data:/data portainer/portainer-ce:latest
c4aadcf0ebed5feeefb3871638e731f6b6a8a6151c5fa98cf5f30bb37edec174

 (3)查看启动的容器

docker ps

[root@localhost ~]# docker ps
CONTAINER ID   IMAGE                           COMMAND        CREATED          STATUS          PORTS                                                                                            NAMES
c4aadcf0ebed   portainer/portainer-ce:latest   "/portainer"   36 seconds ago   Up 35 seconds   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp, 9443/tcp   portainer

(4)查看portainer-ce容器日志 

docker logs portainer

[root@localhost ~]# docker logs portainer
2023/08/29 07:07PM INF github.com/portainer/portainer/api/cmd/portainer/main.go:495 > encryption key file not present | filename=portainer
2023/08/29 07:07PM INF github.com/portainer/portainer/api/cmd/portainer/main.go:518 > proceeding without encryption key |
2023/08/29 07:07PM INF github.com/portainer/portainer/api/database/boltdb/db.go:124 > loading PortainerDB | filename=portainer.db
2023/08/29 07:07PM INF github.com/portainer/portainer/api/internal/ssl/ssl.go:80 > no cert files found, generating self signed SSL certificates |
2023/08/29 19:07:58 server: Reverse tunnelling enabled
2023/08/29 19:07:58 server: Fingerprint 9f:a5:99:95:bf:11:da:99:7d:c8:16:bd:51:6c:10:a6
2023/08/29 19:07:58 server: Listening on 0.0.0.0:8000...
2023/08/29 07:07PM INF github.com/portainer/portainer/api/cmd/portainer/main.go:766 > starting Portainer | build_number=32198 go_version=1.19.4 image_tag=linux-amd64-2.18.4 nodejs_version=18.16.1 version=2.18.4 webpack_version=5.68.0 yarn_version=1.22.19
2023/08/29 07:07PM INF github.com/portainer/portainer/api/http/server.go:345 > starting HTTPS server | bind_address=:9443
2023/08/29 07:07PM INF github.com/portainer/portainer/api/http/server.go:330 > starting HTTP server | bind_address=:9000

 3、Portainer页面配置

(1)浏览器访问Portainer

URL地址:http://192.168.237.141:9000/

如果页面提示以下信息,则按提示信息重启portainer容器即可: 

Your Portainer instance timed out for security purposes. To re-enable your Portainer instance, you will need to restart Portainer.

Centos7 安装Docker管理工具Portainer_第1张图片

 重启portainer容器

docker restart c4aadcf0ebed

[root@localhost ~]# docker ps
CONTAINER ID   IMAGE                           COMMAND        CREATED          STATUS          PORTS                                                                                            NAMES
c4aadcf0ebed   portainer/portainer-ce:latest   "/portainer"   11 minutes ago   Up 11 minutes   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp, 9443/tcp   portainer
[root@localhost ~]# docker restart c4aadcf0ebed
c4aadcf0ebed

 此时页面显示如下:

Centos7 安装Docker管理工具Portainer_第2张图片

(2)配置管理员账号

设置管理员用户名及密码,密码提示需要至少12个字符长度

Centos7 安装Docker管理工具Portainer_第3张图片点击按钮Create user,页面显示如下:

Centos7 安装Docker管理工具Portainer_第4张图片

以上portainer配置已完成,关于如何使用,可参见官网说明:Home - Portainer Documentation 

你可能感兴趣的:(Docker,docker)