Docker Introduction[Day 16 Task]
Table of contents
- 1. What Is Docker??
- 2. Usage Of Docker
- 3. Now What is this Container?
- 4. What is a Virtual Machine?
- 5. What is Containerization?
- 6. Difference between containerization and Virtualization?
- 7. Docker Images:
- 8. Docker Architecture:
- 9. Installation of Docker:
- 10. Some Commands of Docker to use containers and images:
1. What Is Docker??
Docker is a centralized open-source platform for packaging, deploying, and running applications. Before Docker, many users face the problem that a particular code is running in the developer's system but not in the user's system. So, the main reason to develop docker is to help developers create applications easily, ship them into containers, and deploy them anywhere.
Docker was first released in March 2013. It is used in the Deployment stage of the software development life cycle that's why it can efficiently resolve issues related to the application deployment.
2. Usage Of Docker
Docker uses containers on the host's operating system to run applications. It allows applications to use the same Linux kernel as a system on the host computer, rather than creating a whole virtual operating system. Containers ensure that our application works in any environment like development, test, or production.
3. Now What is this Container?
Docker containers are lightweight alternatives to the virtual machine. It allows developers to package up the application with all its libraries and dependencies, and ship it as a single package. The advantage of using a docker container is that you don't need to allocate any RAM and disk space for the applications. It automatically generates storage and space according to the application requirement.
4. What is a Virtual Machine?
A virtual machine is software that allows us to install and use other operating systems (Windows, Linux, and Debian) simultaneously on our machine. The operating system in which virtual machine runs are called virtualized operating systems. These virtualized operating systems can run programs and perform tasks that we perform in a real operating system.
Hypervisor: A piece of software that enables virtualization in a system**.** A hypervisor allows one host computer to support multiple guest VMs by virtually sharing its resources, such as memory and process.
5. What is Containerization?
In the software development process, code developed on one machine might not work perfectly fine on any other machine because of the dependencies. This problem was solved by the containerization concept. So basically, an application that is being developed and deployed is bundled and wrapped together with all its configuration files and dependencies. This bundle is called a container. When you wish to run the application on another system, the container is deployed which will give a bug-free environment as all the dependencies and libraries are wrapped together. Famous containerization environments are Docker and Kubernetes.
6. Difference between containerization and Virtualization?
7. Docker Images:
A Docker image is a read-only template that contains a set of instructions for creating a container that can run on the Docker platform. It provides a convenient way to package up applications and preconfigured server environments, which you can use for your private use or share publicly with other Docker users.
8. Docker Architecture:
Docker Components:
Docker Daemon: Docker Daemon runs on the host operating system. It is responsible for running containers to manage docker services.
Docker Client: Docker client uses commands and REST APIs to communicate with the Docker Daemon (Server). When a client runs any docker command on the docker client terminal, the client terminal sends these docker commands to the Docker daemon. The Docker daemon receives these commands from the Docker client in the form of commands and REST API requests. The client uses these three commands:
docker build
docker pull
docker run
Docker Host: Docker Host is used to providing an environment to execute and run applications. It contains the docker daemon, images, containers, networks, and storage.
Docker Registry: Docker Registry manages and stores the Docker images.
There are two types of Registries:
Public and Private
9. Installation of Docker:
$ sudo apt-get install docker.io [In ubuntu system]
After installation of Docker, you have to add the user to the Docker group and then reboot your system.
10. Some Commands of Docker to use containers and images:
Use the docker run command to start a new container and interact with it through the command line.
This is a command to run a container and the image name is Centos, A container is created. To check a running container use the command docker ps and the container is up &running.
- Use the docker inspect command to view detailed information about a container or image.
You can check your images list by using the docker images command. To inspect an image to check all the info in detail use the command docker inspect <image or container name>
- Use the docker port command to list the port mappings for a container.
There are no ports available.
Use the docker stats command to view resource usage statistics for one or more containers
docker stats <container name or id>
-
Use the docker top command to view the processes running inside a container
Use the docker save command to save an image to a tar archive.
Save the Ubuntu image by giving the present working directory path i.e. /home/ubuntu/ubuntu.tar
Use the docker load command to load an image from a tar archive.
Load an image from a tar archive.
That's all for today :)
Subscribe to my newsletter
Read articles from Maher Messaoudi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by