What are docker containers used for?
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.
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Four ways to exit Docker container: Use Ctrl D in the container terminal Enter exit command in the container terminal Use docker stop <container_name> Command Use docker kill <container_name> command in the host terminal (force exit)

Methods for copying files to external hosts in Docker: Use the docker cp command: Execute docker cp [Options] <Container Path> <Host Path>. Using data volumes: Create a directory on the host, and use the -v parameter to mount the directory into the container when creating the container to achieve bidirectional file synchronization.

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

How to restart the Docker container: get the container ID (docker ps); stop the container (docker stop <container_id>); start the container (docker start <container_id>); verify that the restart is successful (docker ps). Other methods: Docker Compose (docker-compose restart) or Docker API (see Docker documentation).

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

The steps to update a Docker image are as follows: Pull the latest image tag New image Delete the old image for a specific tag (optional) Restart the container (if needed)

Create a container in Docker: 1. Pull the image: docker pull [mirror name] 2. Create a container: docker run [Options] [mirror name] [Command] 3. Start the container: docker start [Container name]

Docker process viewing method: 1. Docker CLI command: docker ps; 2. Systemd CLI command: systemctl status docker; 3. Docker Compose CLI command: docker-compose ps; 4. Process Explorer (Windows); 5. /proc directory (Linux).
