# 安装docker相关依赖
yum install -y yum-utils device-mapper-persistent-data lvm2
# 阿里仓库
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 查看docker版本
yum list docker-ce --showduplicates | sort -r
# 安装docker
yum -y install docker-ce.x86_64
# 启动 docker
systemctl start docker
# 设置开启自启动
systemctl enable docker
# 查看安装的docker版本
docker version
# 下载docker-compose到/usr/local/bin/docker-compose
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# 授权/usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# 对/usr/local/bin/docker-compose建立软链接
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# 查看安装的docker-compose版本
docker-compose --version
创建docker-compose.yml
vi docker-compose.yml
内容入下:
version: "3.6"
services:
portainer-mian:
container_name: portainer
image: portainer/portainer:latest
ports:
- "9000:9000"
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
- ./ortainer_data:/data:rw
# networks:
# - traefik
# labels:
# - "traefik.enable=true"
# - "traefik.docker.network=traefik"
# - "traefik.http.routers.portainer_halobug.entrypoints=https"
# - "traefik.http.routers.portainer_halobug.rule=Host(`92.168.1.6`)"
# - "traefik.http.routers.portainer_halobug.tls=true"
# - "traefik.http.services.portainer_halobug-backend.loadbalancer.server.scheme=http"
# - "traefik.http.services.portainer_halobug-backend.loadbalancer.server.port=9000"
# logging:
# driver: "json-file"
# options:
# max-size: "10m"
#networks:
# traefik:
# external: true
启动:
docker-compose down && docker-compose up -d
1、https://blog.51cto.com/bovin/2170723
2、https://blog.csdn.net/qfzhaohan/article/details/121907559
3、https://blog.csdn.net/bigbear00007/article/details/123562211