Working with Docker
In this article, we’ll go through a real quick way of starting a Docker Swarm service without installing and setting up the environment — PWD.
Let’s start playing with Docker in PWD
Play with Docker
Login with you Docker Hub account. Click on start, as shown below.
Play with Docker
Here you see two options to create the Docker instance,
1. Click on the button, ADD NEW INSTANCE, to create a single instance
Adding a New Instance
2. Click on the Wrench to set up five instances of an operating system running Docker.
Docker Instances
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 instances are ready to use:
Docker Swarm Kit
Let’s Run a Service of Three replicas
A basic understanding of the Docker run
command is a plus if you want to create a Docker service via the create
command. But, it is fine even if you don’t have experience i this area.
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
Default Page in Nginx
As the result of the command you will see the the service is created and you can view it at port 8000.
Nginx Server
Now you can check with the services created in the instances
docker ps -a
Docker Instances
For reading, this may take more time compare to implemention. Let’s jump in and implement it. Have fun playing with Docker.
source: https://dzone.com/articles/play-with-docker-docker-swarm