Bart Simons

Bart Simons

Thoughts, stories and ideas.

Bart Simons



Using to build and manage your Docker swarm

Bart SimonsBart Simons

Are you planning on deploying a Docker swarm anytime soon? Just rethink about how you want to manage your Docker compute hosts. Do you want to go with the CLI way of doing things, or are you most likely preferring a GUI-based frontend to manage your Docker swarm? Personally I'm a fan of doing all the things over a CLI interface, but hey: GUI-managed solutions can be good if they are done right.

So, let's get straight into talking about what can do for you and your (future) Docker environment: most of the things that you would usually do in the Docker CLI interface are made into a sleek-looking graphical interface with Portainer.

Setting up a basic Docker swarm with two compute nodes

Imagine having three servers for your Docker setup:

These are the IP addresses of the 3 machines

On the 'Docker Manager' machine, you execute the following command to initialise a new Docker swarm:

docker swarm init --advertise-addr

This command also returns what you need to know to make compute nodes join your Docker swarm:

Docker Swarm Init

Once you have all your member servers joined into your swarm you can install on your Docker management server with this command:

docker service create --name portainerio -p 9000:9000 --constraint 'node.role == manager' --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock portainer/portainer -H unix:///var/run/docker.sock

You are now running a instance on port 9000, great! Open your webbrowser and navigate to the web interface, fill in a password and login with the password that you just set.

Docker swarm in

Boom! It works and shows you all the worker machines inside the web panel. Now it's all up to you what you are going to build and/or deploy. I hope this article was informative for you, enjoy the freedom of containers!

Bart Simons

Bart Simons

View Comments