Portainer is a nice tool to manage your Docker environment. It supports Docker Swarm and is able to remotely connect to the Docker API.
Before we start, you need create a swarm cluster with portainer running as a service.
You can follow my previous blog post Create a multiple node swarm cluster using Docker Machine in your Mac. Once you have a swarm cluster, you can go continue.
By default, the Docker API is secured and TLS is enabled. For development, we can disable TLS. Never do this in production!
Edit this file /var/lib/boot2docker/profile in all of the nodes.
and change line DOCKER_TLS=auto to
Restart the docker engine in the node
sudo /etc/init.d/docker restart
You need to this in all the nodes so we can configure it in Portainer. Once configured and all docker engines restarted, we can now configure portainer. For now, let's just add node1, IP is 192.168.99.106 in this example. We can add additional endpoints later.
Once logged into portainer, you can now check services running in the swarm cluster by clicking "Services" in the left menu.
Let's add the other 2 nodes. Click "Endpoints" in the left menu and click +Add Endpoint. Enter node2 and node3 URLs.
Cool, now we have node2 and node3 added. You can now check containers running on each node.
You can uncheck Show all containers so it will not display stopped containers.
Swarm Visualizer is also available you can see a visual view of which services are running in each node in your swarm cluster.
That's it! You can now use Portainer to manage your Docker Swarm Cluster!