[Containers] Docker basic management

1. Docker overview

1.1 What is Docker?

  • It is an open source application container engine , developed based on the go language and open source following the apache2.0 protocol
  • is an open source tool for running applications in Linux containers
  • Is a lightweight "virtual machine"
  • Docker's container technology makes it easy to create a lightweight, portable, self-sufficient container for any application on a single host

The logo of Docker is designed as a blue whale, dragging many containers.
The whale can be regarded as a host machine, and the container can be understood as a container isolated from each other. Each container contains its own application

insert image description here

1.2 The purpose of Docker

That is, through the management of the life cycle of application components such as encapsulation, release, deployment, and operation, the purpose of " encapsulating once and running everywhere " at the application component level is achieved . The application here can be either an application or a set of services. Or even a full operating system.

1.3 Advantages of containers

  • Flexible : Containerize even the most complex applications
  • Lightweight : containers utilize and share the host kernel
  • Interchangeable : Updates and upgrades can be deployed instantly
  • Portable : Can be built locally, deployed to the cloud, and run anywhere
  • Scalable : Can increase and automatically distribute container replicas
  • Stackable : Services can be stacked vertically and instantly

1.4 Difference between Docker and virtual machine

characteristic Docker container virtual machine
startup speed second level minute level
Computing Power Loss almost none Lost about 50%
performance close to native weaker than
System support (stand-alone) Thousands tens of
isolation Resource isolation/limitation completely isolated

1.5 Two technologies supported by containers in the kernel

The essence of Docker is a process of the host machine. Docker implements resource isolation through namespace, resource limitation through cgroup, and efficient file operation through copy-on-write technology (similar to the disk of a virtual machine, such as allocating 500g and It does not actually take up 500g of the physical disk, and only copies a copy of the data when it needs to be modified)

Six types of namespace

insert image description here

2. The core concept of Docker

2.1 Mirroring

A Docker image is the basis for creating a container, similar to a snapshot of a virtual machine, and can be understood as a read-only template for the docker engine. A container is
started through an image. An image is an executable package that includes the required components to run an application. All content includes code, runtime, libraries, environment variables, and configuration files. The
docker image is also a compressed package, but this compressed package is not just executable files, environment deployment scripts, it also contains a complete operating system, because most of the images They are all based on a certain operating system, so it is easy to build the same local and remote environment, which is the essence of docker image.

2.2 Container

A docker container is a running instance created from an image, which can be started, stopped and deleted. Each container created is isolated and invisible to each other to ensure the security of the platform.
The container can be regarded as a simple version of the Linux environment (including root user authority, mirror space, user space and network space, etc.) and the applications running in it

2.3 Warehouse

The Docker warehouse is used to centrally save the image. After creating your own image, you can use the push command to upload it to a public warehouse (public) or a private warehouse (private). When you want to use this image on another machine next time , just get it from the warehouse

Docker images, containers, logs, etc. are all stored in /var/lib/docker by default

Summarize

  1. docker is an application container engine developed in go language, used to run applications in containers, docker is a tool used to manage containers and images

  2. The current mainstream container engine: docker containerd podman

  3. 6 namespace resource isolation: mnt mount point isolation, user user isolation, pid process isolation,
    ipc communication isolation, net network isolation, uts host name/domain name isolation.

  4. Three core concepts of docker:

  • Image : It is the basis for creating a container. It is a read-only template file that contains all the content needed by the application in the container (including program running files, configuration files, runtime files, and running environment)
  • Container : It is an instance running with a mirror. Containers can be created, started, stopped, and deleted. Each container is isolated from each other by default.
  • Warehouse : A place for storing mirror images, divided into public warehouses and private warehouses

Guess you like

Origin blog.csdn.net/2302_76410765/article/details/131788922