In this blog you will learn about the fundamentals of the docker container.
So before learning about docker, let's know about a few topics so that you can understand them clearly.
The kernel is the essential centre of a computer operating system (OS). It is the core that provides basic services for all other parts of the OS. It is the main layer between the OS and hardware, and it helps with process and memory management, file systems, device control and networking.
also known as Virtual Machine Monitor(VMM) is software that allows one host OS to support multiple guest VM(virtual machines) by virtually sharing its resources such as memory and processing.
In computing, It is the act of creating a virtual version of something.
Runs the whole OS on the hypervisor(the whole OS include the kernel). It should have its own kernel and OS.
The below image will explain virtualization.
is the technique of bringing virtualisation to the operating system level. Virtualization brings abstraction to the hardware, Containerization brings abstraction to the operating system. Each and every container will communicate with the host's kernel. If the containers are destroyed it will not affect the host OS, because every container is an image by default.
c1,c2,c3 are nothing but containers.
WITH THIS KNOWLEDGE LETS LEARN ABOUT DOCKER.
INTRODUCTION TO DOCKER
Docker is a set of platforms as a service product that uses OS-level virtualisation(refer to containerisation topic) to deliver software packages called containers.
there are some topics to know in docker.
Dockerfile, Docker Image And Docker Container:
is created by the sequence of commands written in a file called docker file.
When this Dockerfile is executed using a docker command it results in a Docker Image with a name.
When this Image is executed by the “docker run” command it will by itself start whatever application or service it must start on its execution.
is like a GitHub for docker images.it is basically a cloud registry where you can find docker images uploaded by different communities. You can also develop a docker image and upload it to the docker hub.
it consists of a docker engine which has three components
A server is a type of long-running program called a daemon process (the docker command).
A REST API specifies interfaces that programs can use to talk to the daemon and instruct it on what to do.
A command-line interface (CLI) client (the docker command).
The CLI uses the Docker REST API to control or interact with the Docker daemon through scripting or direct CLI commands. Many other Docker applications use the underlying API and CLI.
Docker Compose is a tool that was developed to help define and share multi-container applications. With Compose, we can create a YAML file to define the services and with a single command, can spin everything up or tear it all down.
for more reference, visit docs.docker.com/compose
Now we have basic Knowledge of docker. Next, let's learn how to install it.
account on docker hub
STEP -1 Installing Docker
first, update existing packages
$ sudo apt update
install a few prerequisite packages
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
then add the GPC key for the official docker repository for your system
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add docker repository to APT sources
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
This will also update our package database with the Docker packages from the newly added repo.
Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:
$ apt-cache policy docker-ce
Finally, install docker
$ sudo apt install docker-ce
After installation check, docker is running
$ sudo systemctl status docker
download it from the site docs.docker.com/desktop/windows/install
download it from the site docs.docker.com/desktop/mac/install
CHECK DOCKER IS INSTALLED
- open docker
enter the following command
$ docker --version
$ docker run hello-world
if you get output like below, then you have installed.
Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (arm64v8) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
And we have come to the end of the blog, but wait this is not the end it's just part 1. In the next blog, let's learn about a few docker commands.
To be continued