Home  >  Article  >  Operation and Maintenance  >  What are docker containers used for?

What are docker containers used for?

WBOY
WBOYOriginal
2022-02-23 11:21:346819browse

In docker, containers provide an efficient mechanism for combining components into application and service stacks and keeping software components updated and maintained; docker containers are not only isolated from each other, but also from the underlying System isolation and can run on any machine that supports container runtime environments.

What are docker containers used for?

The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.

What docker containers are used for

One of the goals of modern software development is that applications can both run on the same host or cluster and be isolated from each other so that they do not Unduly interfere with each other's operation or maintenance, but this becomes more difficult due to running packages, libraries, and other software components.

One solution to this problem is to use a virtual machine, which completely isolates applications on the same hardware and minimizes conflicts between software components and competition between hardware resources, but virtual machines The machine size is relatively large, and each virtual machine requires its own operating system, so it is usually GB in size and difficult to maintain and upgrade.

Contrary to virtual machines, containers isolate application execution environments from each other but share the underlying OS kernel. They are typically measured in megabytes, use far fewer resources than virtual machines, and start almost instantly. It is possible to pack more densely on the same hardware without much effort and overhead.

Containers provide an efficient and highly granular mechanism to combine software components into the various application and service stacks required by modern enterprises, and to keep these software components updated and maintained.

Docker is an open source project that makes it easy to create containers and container-based applications. Originally built for Linux, it now also runs on Windows and MacOS.

Docker has always been able to help developers quickly build lightweight and portable software containers, thereby simplifying application development, testing and deployment. Specifically, it is a software platform for building applications that provides a small and lightweight execution environment that shares the operating system kernel but otherwise runs independently.

Although the concept of containers has been around for a long time, the open source project Docker launched in 2013 has largely helped popularize this technology and promoted the trend of containerization and microservices in software development. This trend came to be known as cloud-native development.

Docker containers provide a way to build enterprise applications and business process applications that are easier to install, maintain, and move than traditional applications.

Docker containers support isolation: Docker containers enable applications to be isolated not only from each other, but also from the underlying system. This not only makes the software stack cleaner, but also makes it easier for containerized applications to use system resources such as CPU, GPU, memory, I/O, network, etc. It also ensures that data and code remain independent.

Docker containers support portability: Docker containers run on any machine that supports the container runtime environment. Applications do not have to be tied to the host operating system, so the application environment and underlying operating environment can be kept clean and minimal.

For example, MySQL with containers will run on most Linux systems that support containers, and all of the application's dependencies are typically provided in the same container. Container-based applications can be easily moved from an on-prem system to a cloud environment, or from a developer's laptop to a server, as long as the target system supports Docker and any third-party tools that may be used with it, such as Kubernetes.

Typically, Docker container images must be built for a specific platform. For example, Windows containers cannot run on Linux, and vice versa; previously, one way to get around this limitation was to launch a virtual machine running an instance of the desired operating system and run the container within the virtual machine.

However, the Docker team later designed a more elegant solution called manifest, which allows images of multiple operating systems to be packaged in parallel. Although the manifest is still in the experimental stage, it hints that containers may become a cross-platform application solution and a cross-environment application solution.

Docker containers support composability: most business applications are composed of several independent components, web servers, databases and cache caches. Docker containers can combine these components into an easily replaceable functional unit. Each part is served by a different container and can be maintained, updated, exchanged, and modified independently of other containers.

This is essentially the microservices model for application design. By dividing application functionality into independent, self-contained services, the microservices model provides a solution to the slow process of traditional development and monolithic rigid applications. Lightweight and portable containers enable building and maintaining microservices-based application just got easier.

Docker containers simplify orchestration and scaling: because containers are lightweight and have little overhead, more containers can be launched on a given system, and containers can also be used in cross-system clusters Scale applications and scale services up or down to meet peak demand or conserve resources.

Most enterprise-grade versions of tools for deploying, managing, and scaling containers are provided through third-party projects. Chief among them is Google's Kubernetes, an automated system that supports container deployment and scaling, as well as container connectivity, load balancing, and management. Kubernetes also provides ways to create and reuse multi-container applications or "Helm charts" so that complex application stacks can be built and managed as needed.

Docker also has a built-in Swarm orchestration mode. Currently, this mode is rarely used, and Kubernetes has become a default choice. In fact Kubernetes is bundled with Docker Enterprise Edition.

Recommended learning: "docker video tutorial"

The above is the detailed content of What are docker containers used for?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn