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.

 重启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

 此时页面显示如下:

(2)配置管理员账号

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

点击按钮Create user,页面显示如下:

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值