一、创建保存数据的卷
安装网址:Install Portainer BE with Docker on Linux - Portainer Documentation
docker pull portainer/portainer
二、根据portainer镜像创建容器
docker run -d -p 8000:8000 -p 9000:9000\
--name portainer --restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer
执行过程:
1-后台启动容器
[root@syf /]# docker run -d -p 8000:8000 -p 9443:9443 \
> --name portainer --restart=always \
> -v /var/run/docker.sock:/var/run/docker.sock \
> -v portainer_data:/data \
> portainer/portainer-ee:latest
Unable to find image 'portainer/portainer-ee:latest' locally
latest: Pulling from portainer/portainer-ee
7721cab3d696: Pull complete
0645e7e2a110: Pull complete
3ce11b94aaa3: Pull complete
Digest: sha256:0dcf19ddc8a844ca1868aac48e3985e3a562f91da40c93558a5c7a21d24d5148
Status: Downloaded newer image for portainer/portainer-ee:latest
c5e3510f205c2cbb2c68faea488ae4e10f28cedb1f92753558f78681240201a42-查看已经启动容器
[root@syf /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c5e3510f205c portainer/portainer-ee:latest "/portainer" 49 seconds ago Up 48 seconds 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp, 9000/tcp portainer
a34aff536643 redis:6.2.6 "docker-entrypoint.s…" 3 weeks ago Up 6 hours 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp redis6.2.6
2a384f369e0b mysql:5.7 "docker-entrypoint.s…" 3 weeks ago Up 6 hours 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql5.7
三、放开端口
- 打开特定端口:
iptables -A INPUT -p tcp --dport <端口号> -j ACCEPT
- 保存规则:
/etc/rc.d/init.d/iptables save
- 重启服务:
/etc/init.d/iptables restart
- 查看端口是否开放:
iptables -L -n
访问地址:https://192.168.1.1:9000
1-第一次设置密码
选择Lcoal
访问页面
Portainerhttp://192.168.1.1:9000/
四、汉化
下载结尾tar.gz的压缩包(我已经上传我的资源,可以直接下载)
Release public · eysp/public · GitHubportainer-ce 汉化文件. Contribute to eysp/public development by creating an account on GitHub.https://github.com/eysp/public/releases/tag/public
4.1上传文件,目录如下
[root@syf portainer]# pwd
/www/env/docker/portainer
[root@syf portainer]# ls
public-public.tar.gz
解压文件到指定的public目录
tar -zvxf public-public.tar.gz
mv public-public public
4.2 拉取镜像(指定版本为2.9.1
docker pull portainer/portainer-ce:2.9.1
查看
[root@syf portainer]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
dockertest 1.0 7f4faa206171 42 hours ago 760MB
centosjava8 1.0 b66e5037b732 2 weeks ago 1.27GB
redis 6.2.6 7614ae9453d1 2 years ago 113MB
mysql 5.7 c20987f18b13 2 years ago 448MB
portainer/portainer-ce 2.9.1 bc46de77a3ff 2 years ago 252MB
4.3 运行容器
/www/env/docker/portainer/public
更换为自己解压文件的路径地址,如上面4.1
/www/env/docker/portainer/data
(此路径为portainer-ce运行的相关数据目录)更换或者去掉映射
docker run -d --restart=always \
--name="portainer" \
-p 9000:9000 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
-v /www/env/docker/portainer/public:/public \
portainer/portainer-ce:2.9.1
运行过程如下
运行容器
[root@syf portainer]# docker run -d --restart=always \
> --name="portainer" \
> -p 9000:9000 \
> -v /var/run/docker.sock:/var/run/docker.sock \
> -v portainer_data:/data \
> -v /www/env/docker/portainer/public:/public \
> portainer/portainer-ce:2.9.1
01426f3991ea51a0ba2682499eca4827db5dd6ee4c6f2c00372388f6a731b76f查看容器
[root@syf portainer]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
01426f3991ea portainer/portainer-ce:2.9.1 "/portainer" 5 seconds ago Up 4 seconds 8000/tcp, 9443/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp portainer
a34aff536643 redis:6.2.6 "docker-entrypoint.s…" 3 weeks ago Up 2 hours 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp redis6.2.6
2a384f369e0b mysql:5.7
访问地址:https://192.168.1.1:9000