Containers - The Perfect Solution for Running Microservices

https://www.nginx.com/blog/introduction-to-microservices/
https://dzone.com/articles/containers-the-perfect-solution-for-running-micros
https://dzone.com/articles/deploying-microservices








Docker:
=======
different technologies and services around containers, like Docker, DockerHub, Docker Swarm, Kubernetes, Azure Container Services (ACS), Azure Container Registry, etc.


deploy Docker containers anywhere, on any physical and virtual machines and even on the cloud.

Components of Docker
Docker has the following components
Docker for Mac − It allows one to run Docker containers on the Mac OS.
Docker for Linux − It allows one to run Docker containers on the Linux OS.
Docker for Windows − It allows one to run Docker containers on the Windows OS.
Docker Engine − It is used for building Docker images and creating Docker containers.
Docker Hub − This is the registry which is used to host various Docker images.
Docker Compose − This is used to define applications using multiple Docker containers.

The Docker daemon
The Docker daemon (dockerd) listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes. A daemon can also communicate with other daemons to manage Docker services.
The Docker client
The Docker client (docker) is the primary way that many Docker users interact with Docker. When you use commands such as docker run, the client sends these commands to dockerd, which carries them out. The docker command uses the Docker API. The Docker client can communicate with more than one daemon.
Docker registries
A Docker registry stores Docker images. Docker Hub and Docker Cloud are public registries that anyone can use, and Docker is configured to look for images on Docker Hub by default. You can even run your own private registry. If you use Docker Datacenter (DDC), it includes Docker Trusted Registry (DTR).
When you use the docker pull or docker run commands, the required images are pulled from your configured registry. When you use the docker push command, your image is pushed to your configured registry.
Docker store allows you to buy and sell Docker images or distribute them for free.
For instance, you can buy a Docker image containing an application or service from a software vendor and use the image to deploy the application into your testing, staging, and production environments.
You can upgrade the application by pulling the new version of the image and redeploying the containers

Docker objects
When you use Docker, you are creating and using images, containers, networks, volumes, plugins, and other objects. This section is a brief overview of some of those objects.
Images
 you might only use those created by others and published in a registry.
 To build your own image, you create a Dockerfile with a simple syntax for defining the steps needed to create the image and run it.
 Each instruction in a Dockerfile creates a layer in the image. When you change the Dockerfile and rebuild the image, only those layers which have changed are rebuilt.
 This is part of what makes images so lightweight, small, and fast, when compared to other virtualization technologies.

 Containers

 A container is a runnable instance of an image. You can create, start, stop, move, or delete a container using the Docker API or CLI
  You can connect a container to one or more networks, attach storage to it, or even create a new image based on its current state.
 
Dockerfile
A Dockerfile is a simple text-file that contains a list of commands that the Docker client calls while creating an image.
It's a simple way to automate the image creation process. The best part is that the commands you write in a Dockerfile are almost identical to their equivalent Linux commands. This means you don't really have to learn new syntax to create your own dockerfiles.
The application directory does contain a Dockerfile but since we're doing this for the first time, we'll create one from scratch.
To start, create a new blank file in our favorite text-editor and save it in the same folder as the flask app by the name of
 docker run hello-world
This should download the very small hello-world image and print a “Hello from Docker“ message.
Understand what we are running!
A lot of stuff happened behind the scenes to get the Hello World running. While we may not go into the specifics of all that for now, these are roughly the steps:
1.You used the docker client application via the docker command.
2.You gave the command run hello-world to the docker client application.
3.In other words, you told the docker client to create an instance of a Docker Image titled hello-world.
4.Where is this Docker Image? On your local system ? Somewhere on the Internet ? What is going on ?
5.Well, the default behaviour is a sensible one i.e. the docker client looked for an Image titled hello-world in your local repository i.e. on your local machine. It did not find it (obviously) — so it went to the Internet and hit a URL at Docker Registry ( a public repository of Docker Images hosted by the company behind Docker). It found it there (I cheated … since I knew the name “hello-world” is one of the existing images out there. But you get the point). Once found, it started to download the Image (all its layers) and once it was present locally, it launched an instance (Container) based on that image.
6.The default command was then executed to print out some message on the console, which is what you saw.
Try out the following Docker commands
Since the image “hello-world” is now present locally, it should be available in our local repository.
Try out :
$ docker images
and verify that you see the image listed there.
Try launching another container based on the same image. Give the following command:
$ docker run hello-world
It should print out the same message that you saw earlier.
The command $ docker ps gives you a list of running containers. Try it out and see if you can find any running.
Try out:
$ docker ps --all
and see if they are visible now.
Recap
Recollect that the Docker toolset consists of:
1.Docker Daemon
2.Docker Client
3.Docker Hub
Now, when we work with the docker client, what is happening is that the commands are being sent to the Docker Daemon, which then interprets the command and executes it for you.
docker client help
The docker client can understand several commands. And in this hands-on step, we are going to take a look at various commands that you will primary use while running docker.
To get help at any point in time try out the following command:
$ docker help
$ docker info
This will show you several pieces of information about the OS.

Comments

Popular posts from this blog

QA's approach 2 Java - Understanding Static context

Selenium 4 absolute beginners - How to create Batch execution file

Technologies - Log4J - Create Log4j Configuration File - Where ? How ? What ?