Skip to content

Instantly share code, notes, and snippets.

@raphaelcastaneda
Last active April 13, 2018 00:58
Show Gist options
  • Save raphaelcastaneda/d827973f357dc390549afd886064a2bb to your computer and use it in GitHub Desktop.
Save raphaelcastaneda/d827973f357dc390549afd886064a2bb to your computer and use it in GitHub Desktop.
Setting up portainer on a docker swarm using portainer-endpoint
#! /bin/bash
#export PORTAINER_PASS=#TODO: add me
#export PORTAINER_ENC_PASS=$(docker run --rm httpd:2.4-alpine htpasswd -nbB admin ${PORTAINER_PASS} | cut -d ":" -f 2)
#echo $PORTAINER_PASS | docker secret create portainer_password.v1 --label portainer -
docker stack deploy --compose-file docker-compose.yml portainer
version: "3.2"
networks:
portainer:
attachable: true
bridge:
external:
name: bridge
services:
portainer:
image: portainer/portainer
networks:
- portainer
- bridge
ports:
- 9000:9000
volumes:
- ~/portainer_data:/data
- /var/run/docker.sock:/var/run/docker.sock
command: [
"--admin-password", "${PORTAINER_ENC_PASS}"
]
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager
resources:
limits:
cpus: '0.20'
memory: 30M
reservations:
cpus: '0.10'
memory: 25M
portainer-endpoint:
image: softonic/portainer-endpoint
networks:
- portainer
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /etc/hostname:/etc/host_hostname
environment:
PORTAINER_ADDR: "portainer:9000"
PORTAINER_USER: "admin"
PORTAINER_PASS: "--DOCKER-SECRET:portainer_password--"
HOST_HOSTNAME: "/etc/host_hostname"
secrets:
- source: "portainer_password.v1"
target: "portainer_password"
uid: "33"
gid: "33"
mode: 0400
deploy:
mode: global
resources:
limits:
cpus: '0.10'
memory: 20M
reservations:
cpus: '0.05'
memory: 10M
secrets:
portainer_password.v1:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment