Centos7-docker安装

1.移除旧版本

yum remove docker
docker-client
docker-client-latest
docker-common
docker-latest
docker-latest-logrotate
docker-logrotate
docker-selinux
docker-engine-selinux
docker-engine
rm -rf /etc/systemd/system/docker.service.d
rm -rf /var/lib/docker
rm -rf /var/run/docker
rm -rf /usr/local/docker
rm -rf /etc/docker

2.安装一些必要的系统工具

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

3.添加软件源信息

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

4.安装Docker-ce

yum install docker-ce -y

5.启动服务

systemctl start docker
systemctl enable docker

6.测试运行 hello-world

docker run hello-world

7.安装centos,并以后台启动的方式运行centos

docker run -itd centos /bin/bash
docker ps
docker exec -it 5e701b7d1438 /bin/bash
cat /etc/RedHat-release

posted @ 2019-10-08 11:28  kylingx  阅读(214)  评论(0编辑  收藏  举报