[Docker] Install docker in linux

Install gcc components first

yum -y install gcc
yum -y install gcc-c++

Uninstall old version

yum -y remove docker docker-common docker-selinux docker-engine

Install the required packages

yum install -y yum-utils device-mapper-persistent-data lvm2

Set up Docker's yum source

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

Update yum package index

yum makecache fast

Install docker Ce

yum -y install docker-ce

Start Docker

systemctl start docker

Check if it is activated

ps -ef | grep docker

test

//查看docker版本
docker version

Search for the image on the Alibaba Cloud official website, find the container image service,
Insert picture description here
find the image accelerator, and
Insert picture description here
configure the image acceleration according to the instructions in the operating document
Insert picture description here

Configure mirror acceleration

mkdir -p /etc/docker


tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://fpcjnjzr.mirror.aliyuncs.com"]
}
EOF

systemctl daemon-reload

systemctl restart docker


Connect docker mirror source

docker run hello-world

Search for mirrors on the official website

Official website link https://hub.docker.com/_/redis

Search redis to
see if there is a mirror
, copy the mirror if there is

Take redis as an example

docker pull redis

Create a container, set up port mapping

docker run -id --name=c_redis -p 6379:6379 redis:6.2.1

Then you can use the physical machine to link redis for testing

Guess you like

Origin blog.csdn.net/WSF34588940/article/details/115308946