gpt4 book ai didi

docker - 使用 docker-compose 安装 Portainer & Portainer Agent?

转载 作者:行者123 更新时间:2023-12-05 02:47:53 28 4
gpt4 key购买 nike

我关注了他们的文档 here如下所示安装 portainer。但后来我才知道他们的文件浏览器选项只有 portainer 代理支持。那么如何将 portainer 代理添加到我的 docker-compose。

version: '2'

services:
portainer:
image: portainer/portainer
command: -H unix:///var/run/docker.sock
restart: always
ports:
- 9000:9000
- 8000:8000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data

volumes:
portainer_data:

注意我找到了一些 instructions如下所示,但我的项目是一个小项目,我不想使用 docker stack 或 cluster。如何仅使用 docker-compose 来安装它?

version: '3.2'

services:
agent:
image: portainer/agent
environment:
# REQUIRED: Should be equal to the service name prefixed by "tasks." when
# deployed inside an overlay network
AGENT_CLUSTER_ADDR: tasks.agent
# AGENT_PORT: 9001
# LOG_LEVEL: debug
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/volumes:/var/lib/docker/volumes
networks:
- agent_network
deploy:
mode: global
placement:
constraints: [node.platform.os == linux]

portainer:
image: portainer/portainer
command: -H tcp://tasks.agent:9001 --tlsskipverify
ports:
- "9000:9000"
- "8000:8000"
volumes:
- portainer_data:/data
networks:
- agent_network
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == manager]

networks:
agent_network:
driver: overlay

volumes:
portainer_data:

最佳答案

我用最简单的方式做到了:

version: '3.2'

services:
agent:
image: portainer/agent
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/volumes:/var/lib/docker/volumes

portainer:
image: portainer/portainer-ce
command: -H tcp://agent:9001 --tlsskipverify
ports:
- "9000:9000"
volumes:
- portainer_data:/data


volumes:
portainer_data:

如果您有改进的想法,请发送拉取请求: https://github.com/barfooos/simple-portainer-deployment

关于docker - 使用 docker-compose 安装 Portainer & Portainer Agent?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64735377/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com