Docker for beginners

docker

Docker for beginners

Everything you need to know: Docker is an open platform for developing, shipping and running applications. Docker enables you to decouple your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure the same way you manage your applications.

Docker creates packaged applications called containers. Each container provides an isolated environment similar to a virtual machine. Unlike VMs, Docker containers do not run a full operating system. They share your hosting cores and virtualize at the software level.

Docker basics:

Docker has become a standard tool for software developers and system administrators. It’s a neat way to quickly launch programs without affecting the rest of your system. You can start a new service with a docker run command.

Containers contain everything needed to run an application, from package dependencies to your source code. You define the steps to create the container as instructions in the Dockerfile. Docker uses a Dockerfile to build an image.

Images define software contained in containers. This is roughly equivalent to booting a VM with an OS ISO. If you create an image, any Docker user can run your application by running docker.

 

How does Docker work?

Containers use kernel features of the operating system to provide virtualized environments. Creating containers from scratch is possible with commands like chroot. It starts a process with a specified root directory instead of the system root. But direct use of kernel features is difficult, insecure and prone to errors.

Docker is a complete solution for producing, distributing and deploying containers. Modern Docker versions consist of several independent components. First, there’s the Docker CLI, which you interact with in your terminal. The CLI sends commands to the Docker daemon. It can run locally or on a remote host. The daemon is responsible for managing containers and the images created from them.

The final component is called Container Runtime. The runtime calls kernel features to launch containers. Docker is compatible with runtimes that adhere to the OCI specification. This open standard allows interoperability between different container tools.

When you’re first starting out, you don’t need to worry too much about Docker’s inner workings. Installing Docker on your system gives you everything you need to build and run containers.

 

Sitecore Docker images repository | Sitecore

Virtual machines and the evolution of Docker:

Long ago, before the introduction of Docker and containers, big companies would buy a lot of servers to make sure their services and business wouldn’t go down. This process usually meant that companies bought more servers than they needed, which was very expensive. But they had to do this because as the number of users on their servers increased, they wanted to make sure they could provide the services they needed without any downtime.

Then we had VMware and IBM, who (there’s still a debate about who introduced it first) introduced virtualization, which allowed us to run multiple operating systems on the same host. This feature could have changed everything but seemed too expensive with multiple cores and operating systems.

So we’re moving quickly to modern containerization. We have a company called Docker that solves a lot of problems.

 

Why do so many people use Docker?

Containers have become very popular because they solve many common challenges in software development. The ability to containerize once and run everywhere reduces the gap between your development environment and production servers.

Using containers ensures that every environment is the same. If you have a new member on your team, they just need to run Docker to launch their own development instance. Once you launch your service, you can use your Docker image to deploy to production.

Docker is easier than a full virtual machine. Virtual machines are general-purpose tools designed to support any possible workload. In contrast, containers are lightweight, self-contained, and more suitable for disposable items. Because Docker shares the host kernel, containers have a negligible impact on system performance. Container startup time is almost instantaneous because you only start processes, not the entire operating system.

Docker makes development and applications easy. This means that apps run the same no matter where they are or what device they’re running on.

Docker containers can be deployed on almost any machine with no compatibility issues, so your software stays on the system, making it simpler to use, less work to develop, and easier to maintain and deploy. Simply put, the days of “this is working on my device” are long gone.

A developer typically starts by accessing Docker Hub, an online cloud repository of Docker containers, and one that contains a preconfigured environment for their particular programming language, such as Ruby or NodeJS, with all the files and frameworks. It is required to receive, kills. Docker is one of the tools that truly lives up to its motto of “build, ship and run”.

more uses:

Across the world and industry, many companies and institutions use Docker to accelerate their development activities. PayPal now has over 700 applications and has converted all of them to container-based applications. They run 150,000 containers and this has helped them increase the productivity of their developers by 50%.

MetLife, another great example, saved a lot on their infrastructure because they were able to use fewer operating systems to manage more applications. This allowed them to save money by reducing infrastructure costs. After migrating to Docker, MetLife saw a 70% reduction in VM costs, a 67% reduction in CPU usage, a 10x reduction in CPU utilization, and a 66% reduction in costs.

 

 

Why is Docker so popular?

Docker is a form of virtualization, but unlike virtual machines, resources are shared directly with the host. This allows you to run many Docker containers where you can only run a few virtual machines.

A virtual machine must maintain a set of resources such as HDD space, memory, processing power, hardware emulation and booting the entire operating system. Then the VM communicates with the host computer through an interpreter program that runs on the host operating system called “Hypervisor”.

On the other hand, Docker communicates natively with the kernel and bypasses the middleman on Linux machines and even Windows 10, Windows Server 2016 and higher.

This means you can run any version of Linux in a container and it will run natively. Not only that, Docker also uses less disk space.

How to get started with Docker?

Docker is a software that runs on Linux and Windows. It creates, manages and even coordinates containers.

The word Docker is derived from an English term meaning dock worker, which means someone who loads and unloads cargo containers from ships.

Docker has three main layers as shown in the figure below:

The runtime is responsible for starting and stopping the containers and works at the lowest level.
The low-level runtime is called runc. Its task is to communicate with the main operating system and start and stop containers
The higher-level runtime is called Containerd. He works a lot. For example, it manages the entire lifecycle of a container, including drawing images, creating network interfaces, and managing runc instances.

 

Check out our blog for more tutorials & articles.

Tags:

Leave a Reply