Docker

Docker

Docker is a platform for developing, shipping and running containerised applications.

Docker enables you to decouple applications from infrastructure allowing you to deliver software quickly and at scale.

Disadvantages of Virtual Machines

Virtual Machines (VM) are abstraction of physical hardware.

They allow you to turn one server into many servers. A hypervisor allows multiple VMs to run on a single machine.

However the downside to this is that each VM contains a full copy of the operating system and other necessary binaries and dependencies. This equates to gigabytes worth of space that is use.

In addition VMs can be slow to boot.

Benefits of Docker Containers

Docker containers run on the Docker Engine.

Standardised – Containers are portable and deployable anywhere

Lightweight – Containers share machine resources such as the OS kernel and therefore do not require and OS per application. Therefore servers can run more efficiently.

Secure – Applications are safer in containers since they are isolated external actors.

Microservices – Docker lends itself very well to the microservice architecture and containerising different components of the application into individual containers.

In addition, since all dependencies, code, runtimes and binaries are all packaged into a single container, we can guarantee that the container will run correctly regardless of where it is deployed and no matter the environment. Containers run the same anywhere.

Docker Engine

The Docker Engine is a client server application comprised of three main components:

  1. A server, also known as the Docker Daemon which is a long running application.
  2. A REST API which specifies interfaces that programs can use to talk to the daemon and instruct it what to do.
  3. A CLI (command line interface) client.

The Docker architecture is client-server.

The Docker client communicates with the Docker daemon, the daemon does the heavy lifting of building, running and distributing the Docker images.

The Docker client and daemon can run on the same system, or the daemon can be remote.

Docker Objects

Images

Docker Images are templates with instructions on how to create Docker Containers.

An executable package that includes everything needed to run an application.

The code, runtime, libraries, environment variables and configuration files.

Containers

A runtime instance of an image.

It is what the image becomes in memory when executed.

Services

Services are containers in production and allow you to scale containers across multiple Docker daemons. They work together as a swarm with multiple managers and workers.

A Service only runs one image and it codifies the way the image is run i.e. ports, replicas etc. so that it has the resources it needs.

In a distributed application, Services represent different pieces of the application.

Scaling a service changes the number of container instances running that piece of software.

Swarms

A group/cluster of machines running Docker.

You use the same Docker commands, but they are now executed on a cluster by a swarm manager.

The machines in a swarm can be physical or virtual.

After joining a swarm, they are referred to as nodes.

Stacks

Docker Stack is used in Docker Swarm.

A single stack is capable of defining and coordinating the functionality of an entire application.

A stack is a group of interrelated services that share dependencies.

They can be orchestrated and scaled together.

Dockerfile

A dockerfile is a file used to create a docker image. It uses a simple syntax to define the steps needed to create and run an image.

Each instruction in the dockerfile creates a layer in the image. When the dockerfile is changed and the image is rebuilt, only the layers that have changed are rebuilt.

This another benefit of Docker images lightweights, small and fast compared to other virtualization technologies.

Docker Compose

Docker Compose is a tool for defining and running multi-container Docker applications.

A docker-compose.yml file configures the applications services, then with a single command docker-compose up Docker will run your entire application.

Container Orchestration

Tools that manage, scale and maintain containerised applications are called orchestrators.

The two most common are Docker Swarm and Kubernetes.

How To Run Containerised Docker Applications in AWS

There are several methods of deploying containerised applications on AWS.

Fargate

Fargate is a fully managed serverless compute service for containers.

Fargate removes the need to provision and manage servers

EC2

EC2 is another option for deploying containers.

References

https://www.docker.com/resources/what-container

https://docs.docker.com/get-started/overview/

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *