CentOS7-docker

doker安装(Centos7)

卸载系统之前可能安装的 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 device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo \ 
https://download.docker.com/linux/centos/docker-ce.repo 

sudo yum-config-manager --add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io

这样就安装好docker和基本环境了,接下来就可以启动docker了

#启动docker
sudo systemctl start docker

#查看docker服务状态 running 就是启动成功
sudo systemctl status docker
sudo systemctl enable docker