Installation docker manner centos7 the environment through yum

1, remove the old version:

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, install some necessary system tools:

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

3, add the software source information:

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

4, update yum cache:

yum makecache fast

5, mounting Docker-ce:

yum -y install docker-ce

6, start the background service Docker:

systemctl start docker

7, test run hello-world:

docker run hello-world

8, install centos, and after the start of the stage run centos:

docker run -itd centos /bin/bash

9, enter centos mirror:

[root@myserver ~]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS               NAMES
f57d4703adc3        centos              "/bin/bash"         About a minute ago   Up About a minute                       jolly_dhawan
[root@myserver ~]# docker exec -it f57d4703adc3 /bin/bash
[root@f57d4703adc3 /]#
[root@f57d4703adc3 /]# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core) 
[root@f57d4703adc3 /]#

So far, Docker environment to build complete.

 

Guess you like

Origin www.cnblogs.com/x00479/p/11374519.html