linux下安装docker和常用命令

1.https://docs.docker.com/engine/install/centos/  docker官网 install on centos

2.开始安装(docker CE社区版)

(1)卸载旧版本(sudo为超级管理员)

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

(2) 安装docker依赖包 

sudo yum install -y yum-utils

(3)设置docker对应的镜像仓库地址

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

(4)安装docker 客户端以及操作的容器(安装完成)

sudo yum install docker-ce docker-ce-cli containerd.io

(5) 启动docker

sudo systemctl start docker

查看docker版本:docker -v    查看docker 镜像:sudo docker images 

 (6)设置docker开机自启动

sudo systemctl enable docker

(7)配置docker 国内阿里镜像加速   登录阿里云-控制台-产品与服务-容器镜像服务-镜像加速器-centos 

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://xxxxkjlo.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

你可能感兴趣的:(springcloud)