Play with Docker | Docker Swarm

Jinna Balu
4 min readMar 16, 2019

Real quick way starting with docker swarm service without installing and setting up the environment is PWD.

Play With Docker gives you the experience of having a free Alpine Linux Virtual Machine in the cloud where you can build and run Docker containers and even create clusters with Docker features like Swarm Mode.

Under the hood DIND or Docker-in-Docker is used to give the effect of multiple VMs/PCs

Play with Docker (PWD) is a project hacked by two Great Docker CAptains Marcos Liljedhal and Jonathan Leibiusky

Let’s start playing with docker in PWD

Once you’re on that page and you can login with your Docker ID. If you don’t have a Docker ID you have to go to https://hub.docker.com/ and create a Docker ID.

It’s a simple signup page to create the docker account and Once you have that, you’ll be able to start your own play with docker instance. Once you’ve logged in you will get the following screen.

Clicked that start button you’ll be in this interface that has a countdown timer on the top left and a blank screen on the right.

What this is…is this is Docker inside of Docker. We don’t to worry about the technicals of that, but we’re running real Docker, on a real server, on the Internet, now we can set up a Docker swarm cluster for us without any effort.

Here you see two options to create the docker instance,

1 Click on the button ADD NEW INSTANCE, to create a single instance

In the left pan you caan see the instance IP and right side you can see shell of the instane.

2 Click on the Wrench, to set up five instances of an operating system that are running Docker inside them.

You can opt to go with 3 Managers and 2 Workers or 5 Managers and no Workers.

It’s going to connect all five together with the Swarm kit tooling. All instance are ready to use

We’ve got five nodes on my left. Your’s might look a little different depending on which template you chose. Click on the instance in the left you will see the respective shell in the right.

Lets run a service of three replicas

Basic understanding of the docker run command is plus to create the docker service create command. It is fine even though you don’t have experience prior.
We’re going to type a single command that will create a new swarm service that runs three instances of the same container across three nodes in a highly available fashion.

We’re going to run a simple Nginx web server and use the default page in Nginx.

docker seervice create --name hello --replicas 3 \
--detach=false --publish 8000:80 nginx

As the result of the command you will see the the service getting created and you will see the port 8000, beside the IP in the right panel. click on 8000 to access the nginx.

Now you can check with the services created in the instances

docker service ls

For reading this may take more time compare to implemention. Lets jump in and implement. Have fun playing with docker

--

--