title: Centos 安装 Docker
date: 2019/5/10
categories:
  - - Linux
    - centos
  - - docker
tags:
  - Linux
  - Centos
  - Docker
description: linux的操作命令温习笔记:文件目录类
copyright_author: Mc
abbrlink: 38012

卸载旧 docker

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

安装环境

sudo yum install -y yum-utils

安装docker

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

开机自启动

systemctl enable docker

启动docker

systemctl start docker

查看版本

docker -v

查看仓库

docker images

使用阿里云镜像

登录阿里云网站 https://cn.aliyun.com/

控制台->容器镜像服务->镜像加速器->查看命令

运行命令

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://c9j8gjq3.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
如果觉得我的文章对你有用,请随意赞赏