安装portainer CE

docker-compose.yaml

---

networks:
  frontend: # 需要提前创建,具体请参考文章后面的链接
    external: true
  backend: # 需要提前创建,具体请参考文章后面的链接
    external: true

volumes:
  portainer-data:
    driver: local

services:
  app:
    container_name: portainer-rp5 #修改成你自己喜欢的名字
    image: portainer/portainer-ce:2.20.1 #版本号,去hub.docker.com 安装最新稳定版
    # ports:
    #  - '8000:8000'
    #  - '9000:9000'
    expose:
      - 9000
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer-data:/data
    networks:
      - frontend
      - backend
    restart: unless-stopped

参考

Docker 安装