Portainer for Docker Swarm

How can we add Portainer to our swarm? I guess it would be best under its own stack rather than inside AutoPirate or one of the others?

Portainer Homepage
Portainer Install Instructions
Portainer Live Demo (user = admin, password = tryportainer)

This looks pretty cool. And it should be pretty simple to create a Dockerfile to deploy it to the swarm.

Here’s a simple stack I just got working:

version: "3"

services:
  app:
    image: portainer/portainer
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/data/portainer:/data
    networks:
      - traefik_public
    deploy:
      labels:
        - traefik.frontend.rule=Host:portainer.funkypenguin.co.nz
        - traefik.port=9000
      placement:
        constraints: [node.role == manager]
    command: -H unix:///var/run/docker.sock

networks:
  traefik_public:
    external: true

I tried to setup an oauth proxy in front of it, but this seems to break authentication (there are instructions for nginx and HAproxy, which seem to indicate some special “magic” is required)

It’s very nice and shiny… :wink:

D

1 Like

Further to this, I’ve just published a recipe (which basically includes the above docker-compose.yml verbatim), at https://geek-cookbook.funkypenguin.co.nz/recipies/portainer/