安装docker
安装docker依赖

yum install -y yum-utils

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

dnf repo-pkgs docker-ce-stable list

yum list docker-ce --showduplicates | sort -r #查看docker的版本

yum -y install docker-ce-19.03.9-3.el7 #例如安装19.03.9版本

yum install docker-ce -y #安装最新版docker
或
yum install -y docker-ce-19.03.9-3.el7

# 同时安装containerd.io docker-compose-plugin执行这个
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin

mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://4bsnyw1n.mirror.aliyuncs.com"],
"exec-opts":["native.cgroupdriver=systemd"]
}
EOF

启动docker

systemctl daemon-reload ; systemctl restart docker;systemctl enable --now docker.service

docker version

docker info

docker常用操作

ls
# cd mymvc
docker build -t 121.5.221.226/myweb/mymvc:$BUILD_ID mymvc/
docker login --username=admin --password 668899 http://121.5.221.226
docker push 121.5.221.226/myweb/mymvc:$BUILD_ID
docker rmi 121.5.221.226/myweb/mymvc:$BUILD_ID