💾 Archived View for gmi.bacardi55.io › blog › 2020 › 04 › 17 › docker-swarm-web-dashboard-with-porta… captured on 2024-08-24 at 23:51:27. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

Docker swarm Web dashboard with Portainer

Posted on 2020-04-17

Context

Today, a very quick blog post to continue the series of my docker swarm services recipes[1]. If you haven't, I suggest reading some of my my home lab[2] posts to give you an idea if you don't already have an understanding of a docker swarm architecture.

1: /categories/swarmservice/

2: /pages/home-lab/

Today's "recipe" is for Portainer[3]. For those living outside the docker world before, Portainer[4] is a web UI to manage docker containers (with or without swarm engine).

3: https://www.portainer.io/

4: https://www.portainer.io/

As indicated on their website: Portainer^1[5]:

5: %5Bhttps://www.portainer.io/%5D(https://www.portainer.io)

Build and manage your Docker environments with ease today.

In a simple configuration with docker running standalone (meaning not with kubernetes or swarm mode), you can just run the portainer/portainer container on your server, but in a swarm mode, you need to deploy agents on each node that will communicate with portainer server.

Installation

Create directory structure first, if you follow my filesystem structure[^2], just do:

mkdir /mnt/cluster-data/{containers-data,services-config}/portainer

Then, create the /mnt/cluster-data/services-config/portainer/docker-compose.yml file:

version: '3'

services:
  agent:
    image: portainer/agent
    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 #changeme
    networks:
      - agent_network
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.role == manager
    volumes:
      - /mnt/cluster-data/containers-data/portainer/:/data #changeme if you don't use this file structure

networks:
  agent_network:
    driver: overlay

Important piece are:

Deploy the stack:

docker stack deploy portainer -c /mnt/cluster-data/services-config/portainer/docker-compose.yml

You can then go to http://<ClusterIPAddress:8000, to create your user and configure portainer (select environment local and then create your user)

And stop it:

docker stack rm portainer

That's it for now, I did say it would be a very quick one :).

[^2]: GlusterFS setup

/gemlog/

Send me a gemini mention

send me an email!