Docker (Fundamentals VM Vs Container Installation Images Containers Docker Architecture)
Docker (Fundamentals VM Vs Container Installation Images Containers Docker Architecture)
and how each component of the Docker system interacts with the others. Let’s look at
Docker and its architecture and its various components in detail. Let us first compare
containers to their closest cousin – Virtual Machines.
Advantages
Resource Efficiency :
Process level isolation and usage of the container host’s kernel is more efficient
when compared to virtualizing an entire hardware server.
www.pragathitech.com M : 9611140077
Portability :
All the dependencies for an application are bundled in the container. This means
they can be easily moved between development, test, and production environments.
The ability to have consistent environments and flexibility with patching has
made Docker a great choice for teams that want to move from waterfall to the modern
DevOps approach to software delivery.
First, let us look take a look at Docker Engine and its components so we have a
basic idea of how the system works. Docker Engine allows you to develop, assemble,
ship, and run applications using the following components:
Docker Daemon :
Docker CLI :
A command line interface client for interacting with the Docker daemon. It
greatly simplifies how you manage container instances and is one of the key reasons
why developers love using Docker.
www.pragathitech.com M : 9611140077
We will see how the different components of the Docker Engine are used, let us
dive a little deeper into the architecture.
Implementation
Docker is available for implementation across a wide range of platforms:
Desktop :
Cloud :
Amazon Web Services, Google Compute Platform, Microsoft Azure, IBM Cloud,
and more.
Docker Architecture :
The Docker architecture uses a client-server model and comprises of the Docker
Client, Docker Host, Network and Storage components, and the Docker Registry/Hub.
Let’s look at each of these in some detail.
www.pragathitech.com M : 9611140077
Docker Client :
The Docker client enables users to interact with Docker. The Docker client can
reside on the same host as the daemon or connect to a daemon on a remote host. A
docker client can communicate with more than one daemon. The Docker client provides
a command line interface (CLI) that allows you to issue build, run, and stop application
commands to a Docker daemon.
The main purpose of the Docker Client is to provide a means to direct the pull of images
from a registry and to have it run on a Docker host. Common commands issued by a
client are:
docker build
docker pull
docker run
www.pragathitech.com M : 9611140077
DockerHost :
Docker Objects :
Various objects are used in the assembling of your application. The main requisite
Docker objects are:
Images :
Images are a read-only binary template used to build containers. Images also
contain metadata that describe the container’s capabilities and needs. Images are used
to store and ship applications. An image can be used on its own to build a container or
customized to add additional elements to extend the current configuration. Container
images can be shared across teams within an enterprise using a private container
registry, or shared with the world using a public registry like Docker Hub. Images are a
core part of the Docker experience as they enable collaboration between developers in
a way that was not possible before.
Containers :
Containers are encapsulated environments in which you run applications. The container
is defined by the image and any additional configuration options provided on starting
the container, including and not limited to the network connections and storage
options. Containers only have access to resources that are defined in the image, unless
additional access is defined when building the image into a container. You can also
create a new image based on the current state of a container. Since containers are
www.pragathitech.com M : 9611140077
much smaller than VMs, they can be spun up in a matter of seconds, and result in much
better server density.
#docker images ( Lists all the images from the local cache )
#docker pull ubuntu ( Execute this command on docker host to pull ubuntu image to
local cache )
#docker images
#docker run –it ubuntu ( Creating ubuntu container with interactive Shell )
#docker attach < Containername / Container ID> ( Brings the container from
background to Foreground )
#docker stats ( Displays information about Running Containers like CPU, Memory
Utilization and along with Network / Disk IO statistics )
www.pragathitech.com M : 9611140077
#docker system prune –a ( This command removes all the stopped containers, Deletes
all the networks not associated to any container, Deletes all the dangling Images )
#docker images
#docker run –name myubuntu –it ubuntu bash ( Creating container with custom name )
#docker inspect <image name / Image ID> ( Displays detailed information of an image )
www.pragathitech.com M : 9611140077