What is docker used for?
Docker is used as a software containerization platform that allows developers to build an application, package it into a container together with its dependent environment, and then easily publish and apply it to any platform.
The use of docker:
As a software containerization platform, Docker allows developers to build applications , package it into a container together with its dependent environment, and then easily publish and apply it to any platform.
1. Thoughts:
Container
Standardization
Isolation
2. Core:
Docker has three cores: image, container, and warehouse.
3. Whale is the operating system.
The application to be delivered is a variety of goods. To put goods of various shapes and sizes on the whale, you have to consider how to place each piece of goods (the supporting environment of the application). It is also necessary to consider whether the goods and goods can overlap (whether the environment the application depends on will conflict).
Nowadays, containers (containers) are used to put each piece of goods in the container, so that the big whales can be placed, stacked and assembled in the same way, saving time and effort.
That is: package it and put it on the whale, and put it on the server. That is, "build-ship-run", so how it runs on your own computer will also run on the server.
4. The process of running a program with docker:
Go to the warehouse and pull the image locally, and then use a command to run the image and turn it into a container.
(1) Image-copied program
Definition:
Docker image can be regarded as a special file In addition to providing the programs, libraries, resources, configuration and other files required for container runtime, the system also contains some configuration parameters (such as anonymous volumes, environment variables, users, etc.) prepared for runtime.
Function:
Similar to a snapshot of a virtual machine, used to create new containers.
Features:
The image does not contain any dynamic data, and its content will not be changed after it is built.
(2) Container-Container
Where the program is run
The image is static, each layer is only readable, and the container It is dynamic, and the application we specify is running in it.
(3) Warehouse - a place where images are stored
A place where images are stored, similar to git
5. Function:
Solve problems caused by inconsistent operating environments. In this way, there will be no situation where "it runs fine locally, but it doesn't work once it's on the server."
Limit the largest CPU to use the memory hard disk, which plays a role in isolation and avoids the situation where "a piece of code creates an infinite loop, fills up the disk, and other programs also hang up."
Summed up in one sentence: Docker’s standardization makes rapid expansion and elastic scaling easy
Recommended related tutorials: docker tutorial
The above is the detailed content of What is docker 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).

Docker container startup steps: Pull the container image: Run "docker pull [mirror name]". Create a container: Use "docker create [options] [mirror name] [commands and parameters]". Start the container: Execute "docker start [Container name or ID]". Check container status: Verify that the container is running with "docker ps".

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]
