Skip to content

Instantly share code, notes, and snippets.

@gustavo8000br
Created February 11, 2020 04:54
Show Gist options
  • Select an option

  • Save gustavo8000br/a491f9e51461a7f9950bba4409e52b74 to your computer and use it in GitHub Desktop.

Select an option

Save gustavo8000br/a491f9e51461a7f9950bba4409e52b74 to your computer and use it in GitHub Desktop.
Run ``docker swarm init`` then ``docker swarm join --token <TOKEN_HERE> <IP_SWARM_MANAGER:PORT>`` then ``docker stack deploy --compose-file=portainer-agent-stack.yml portainer``
version: '3.5'
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:
- portainer-net
deploy:
mode: global
placement:
constraints: [node.platform.os == linux]
web:
image: portainer/portainer
command: -H tcp://tasks.agent.portainer-net:9001 --tlsskipverify
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- data:/data
networks:
- portainer-net
ports:
- target: 9000
published: 9000
protocol: tcp
mode: host
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == manager]
networks:
portainer-net:
attachable: true
name: portainer-net
volumes:
data:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment