0

Docker Swarm Visualizer

Introduction

The Swarm Visualizer is a sample app that is useful to get a high level overview of your swarm cluster. It gives us a web GUI to see our Swarm nodes and where services are running in the Swarm.  It talks to the Docker API securely through the “Linux socket” and auto-updates a web UI of what’s happening. it’s also just fun to see things happening in real-time graphically.

If you want to know more about setting upa a docker swarm cluster, please refer here

Swarm Visualizer

How to create a docker swarm visualizer service?

SSH to docker swarm manager node and run below command

$ docker service create --name=visualizer --publish=8080:8080/tcp --constraint=node.role==manager --mount=type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock dockersamples/visualizer 

Verify the service is running by docker service ls command

Create a docker stack deploy file called visualizer.yml for production deployment.

version: '3.7'

services:
  visualizer:
    image: dockersamples/visualizer:stable
    ports:
      - 8080:8080
    networks:
      - prod
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.role == manager
      resources:
        reservations:
          cpus: '0.1'
          memory: 256M
        limits:
          cpus: '0.4'
          memory: 256M

networks:
  prod:
    external:
      name: prod_net

Let’s deploy docker swarm visualizer to the docker swarm cluster

$ docker stack deploy --composefile visualizer.yml prod

Conclusion

We have successfully deployed the visualizer to the docker swarm.

Reference

https://github.com/dockersamples/docker-swarm-visualizer

Leave a Reply

Your email address will not be published. Required fields are marked *