Lift the veil of Docker (theory + installation)

Docker overview

What is Docker

  1. Is a lightweight "virtual machine"
  2. Open source tools for running applications in Linux containers

The difference between Docker and virtual machine

virtual machine container
Start Time slow fast
capacity Big small
system Logical isolation Depends on the kernel (shared)
Safety Strong weak

Docker usage scenarios

  1. Packaged applications simplify deployment
  2. Can be freely migrated away from the underlying hardware
  3. Example: server migration from Tencent Cloud to Alibaba Cloud

Douker's core concept and installation method

Docker core concepts

Mirror image

A read-only module for Docker container engine

container

Create a running instance from the image

warehouse

Where to centrally save the image

Example: upload and download a certain service
Insert picture description here

Two ways to install Docker on CentOS

Use CURL to get Docker installation script to install
Use YUM warehouse to install Docker

Install DockerInsert picture description here

1. Install dependent packages

[root@localhost ~] # yum install -y yum-utils device-mappeer-persistent-data lvm2

Insert picture description here

2. Set up Alibaba Cloud image source

[root@localhost /etc/yum.repos.d] # yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

Insert picture description here

3. Install Docker-CE

[root@localhost /etc/yum.repos.d] # yum install -y docker-ce

Insert picture description here

systemctl start docker
systemctl status docker
systemctl enable docker

Insert picture description here
Insert picture description here
There is an additional bridge network card docker0
Insert picture description here
to explain the bridge network card
Insert picture description here

Docker image operation

Search mirror
docker search keyword

Insert picture description here

Get mirror
docker pull warehouse name[:label]
View mirror
docker images warehouse name[:label]
docker inspect image ID number

Insert picture description here

Add new label
docker tag name[:label]new name[:new label]
Delete mirror
docker rmi warehouse name[:tag]
or
docker rmi image ID number

Insert picture description here
At this point, the installation is over. You can download a service mirror from the shared warehouse at will. The above nginx is downloaded from the shared warehouse.

Guess you like

Origin blog.csdn.net/weixin_51622156/article/details/115082028