MindMap Gallery Docker
Docker related knowledge, including installation, startup, mirroring, containers, dockerfile, etc. Most nodes have pictures attached inside.
Edited at 2024-01-17 09:45:26El cáncer de pulmón es un tumor maligno que se origina en la mucosa bronquial o las glándulas de los pulmones. Es uno de los tumores malignos con mayor morbilidad y mortalidad y mayor amenaza para la salud y la vida humana.
La diabetes es una enfermedad crónica con hiperglucemia como signo principal. Es causada principalmente por una disminución en la secreción de insulina causada por una disfunción de las células de los islotes pancreáticos, o porque el cuerpo es insensible a la acción de la insulina (es decir, resistencia a la insulina), o ambas cosas. la glucosa en la sangre es ineficaz para ser utilizada y almacenada.
El sistema digestivo es uno de los nueve sistemas principales del cuerpo humano y es el principal responsable de la ingesta, digestión, absorción y excreción de los alimentos. Consta de dos partes principales: el tracto digestivo y las glándulas digestivas.
El cáncer de pulmón es un tumor maligno que se origina en la mucosa bronquial o las glándulas de los pulmones. Es uno de los tumores malignos con mayor morbilidad y mortalidad y mayor amenaza para la salud y la vida humana.
La diabetes es una enfermedad crónica con hiperglucemia como signo principal. Es causada principalmente por una disminución en la secreción de insulina causada por una disfunción de las células de los islotes pancreáticos, o porque el cuerpo es insensible a la acción de la insulina (es decir, resistencia a la insulina), o ambas cosas. la glucosa en la sangre es ineficaz para ser utilizada y almacenada.
El sistema digestivo es uno de los nueve sistemas principales del cuerpo humano y es el principal responsable de la ingesta, digestión, absorción y excreción de los alimentos. Consta de dos partes principales: el tracto digestivo y las glándulas digestivas.
Docker
The difference between virtual machine and docker
virtual machine
shortcoming
Taking up a lot of resources
Many redundant steps
Slow startup
docker
The difference between the two
Traditional virtual machine technology is to virtualize a set of hardware, run a complete operating system on it, and then run the required application processes on the system;
The application process in the container runs directly on the host's kernel. The container does not have its own kernel, and there is no hardware virtualization. Therefore, containers are lighter than traditional virtual machines.
Each container is isolated from each other, and each container has its own file system. The processes between containers will not affect each other, and computing resources can be distinguished.
The basic components of docker
docker architecture diagram
Basic concepts in docker
image
Docker image (Image) is a read-only template. Images can be used to create Docker containers, and one image can create many containers. Just like classes and objects in Java, classes are images and containers are objects!
container
Docker uses a container (Container) to run an application or a group of applications independently. Containers are running instances created from images.
It can be started, started, stopped, deleted. Each container is isolated from each other to ensure a secure platform.
A container can be thought of as a simplified version of the Linux environment (including root user permissions, process space, user space, network space, etc.) and the applications running in it.
The definition of a container is almost exactly the same as that of an image. It is also a unified perspective of a bunch of layers. The only difference is that the top layer of the container is readable and writable.
repository
Repository is a place where image files are stored centrally.
There is a difference between a warehouse (Repository) and a warehouse registration server (Registry). There are often multiple warehouses stored on the warehouse registration server, and each warehouse contains multiple images. Each image has a different tag.
Warehouses are divided into two forms: public warehouse (Public) and private warehouse (Private).
The largest public repository is Docker Hub (https://hub.docker.com/), which stores a large number of images for users to download. Domestic public warehouses include Alibaba Cloud, NetEase Cloud, etc.
Installation and usage of docker
Install
Environment view
Make sure it is centos7 and above version
Check your own kernel
uname -r
View version information
cat /etc/os-release
yum installs gcc related environment
C language compilation environment gcc
c compilation environment gcc-c
Install yum tool package collection
usage
Launch and verify
Set up startup
Common commands
Container related
Create a new container and start it
From image to container
Start/stop containers
Already existing container
One of these two is a container that did not exist before, and the other is a container that already exists.
Show containers (running/not running)
View container logs
Exit container
Delete container
View all container IDs
Check the container’s environment variables
The command to enter the container
View container/image metadata
Copy files from container to host
Mirror related
Delete image
Delete all images
View image
docker related
help command
docker restart
Build a development environment in dokcer
docker and tomcat
The steps are the same as Ng installation
Problems during access
solution
firewall
View firewall status
Turn off the firewall with the command
When the firewall is turned off and still cannot be accessed
There is no content under webapps
Build other functions in dokcer
docker and ZenTao
premise
step
Pull image
boot image
access and install
Install nginx using docker
The rest of the installation is similar steps
Search for images
Pull image
Start container
test access
Enter the container
Data volumes in docker
What is a data volume
Data volumes are directories and files
Docker does not delete its mounted data volumes when the container is deleted
What can the data volume be used for?
Container volumes and hosts are interconnected
Container volume ro and rw read and write rules
Inheritance between container volumes
Features
Data volumes can share or reuse data between containers
Changes in the volume can take effect directly
Changes in the data volume will not be included in updates to the mirror
The life cycle of a data volume lasts until no containers use it.
To summarize in one sentence: It is the persistence of containers, as well as inheritance and data sharing between containers!
Data volume usage
Use -v to mount
Use docker inspect container id to check whether the mounting is successful
After the container stops and exits, the files modified on the host will still be synchronized to the container after the container is started.
dockerFile
definition
DockerFile is a build file used to build a Docker image. It is a script composed of a series of commands and parameters.
basic knowledge
Each reserved word instruction must be in uppercase letters and followed by at least one argument.
Instructions are executed sequentially from top to bottom.
# represents comments
Each instruction creates a new image layer and commits the image
Build steps
Build steps
Write dockerFile
docker build build image
docker run
Built execution flow
docker runs a container from a base image
Execute an instruction and make changes to the container
Perform an operation similar to docker commit to submit a new image layer
Docker then runs a new container based on the image just submitted.
Execute the next instruction in the dockerfile until all instructions are executed
dockerFile directive
Popular understanding of instructions
Divide instructions into three broad categories
build
both
run
CMD
ENTRYPOINT
Image build command
dockerFile/docker image/docker container represents three different stages
DockerFile is the raw material (code) of software
DockerFile for development
The Docker image is the software deliverable (.apk)
Docker images become delivery standard
Docker container is the running status of the software (customer downloads, installs and executes)
Docker containers involve deployment and operation and maintenance
Explanation of docker network
When installing docker, three networks are automatically created
View command: docker network ls
Three types of networks
bridge
The default is this mode. This mode allocates and sets IP for each container, connects the container to a docker0 virtual bridge, and communicates with the host through the docker0 bridge and iptables nat table configuration.
none
This mode turns off the networking capabilities of the container
host
The container will not virtualize its own network card, configure its own IP, etc., but use the host's IP and port.
Common commands of docker
Common commands of docker
help command
docker version
Display docker version information
docker info
Display docker system information, including the number of images and containers
docker --help
help command
Mirror command
Mirror view
docker images
Mirror search
docker search mysql
Image pull
docker pull mysql:5.7
docker pull
If you do not write a tag, the default is latest.
Image deletion
docker rmi -f container id
Delete the specified container
docker rmi -f container id container id container id
Delete multiple containers
docker rmi -f $(docker images -aq)
Delete all containers
docker images -aq
List all images and only show id
Container commands
Create a new container and start it
docker run [optional parameter] image
Parameter Description
Enter the already started container
docker run -it centos /bin/bash
Exit container
exit
List all running containers
docker ps
Parameter Description
Container deletion
docker rm container id
Delete the specified container. Running containers cannot be deleted. If the deletion is forced, use rm -f
docker rm -f $(docker ps -aq)
Delete all containers
docker ps -aq
Query all containers and only display container IDs
docker ps -a -q|xargs docker rm
Delete all containers
Other commonly used commands
View log command
docker logs -f -t --tail 200 container id
View container/image metadata
docker inspect container id