Docker安装

安装gcc

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

卸载旧版本docker

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

安装所需的软件包

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

设置阿里云仓库

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

更新 yum 软件包索引

yum makecache fast

安装 Docker Engine-Community

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

启动 Docker

systemctl start docker

开机自动启动

systemctl enable docker

查看 Docker 版本

docker version

通过运行 hello-world 映像来验证是否正确安装成功

docker run hello-world

配置 Docker 阿里云镜像加速地址

mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["你自己的阿里云镜像加速地址"]
}
EOF
systemctl daemon-reload
systemctl restart docker

查看 hello-world 镜像

docker images

卸载 Docker

# Uninstall the Docker Engine, CLI, and Containerd packages
yum remove docker-ce docker-ce-cli containerd.io

# To delete all images, containers, and volumes
rm -rf /var/lib/docker
上一篇:IDEA输出带有颜色的语句


下一篇:初学java记录