Centos7下安装docker

首先卸载所有和docker相关的软件

$ sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine
设置docker安装仓库
$ 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

安装Docker CE

sudo yum install docker-ce

查看其他可安装版本:
# yum list docker-ce --showduplicates | sort -r
docker-ce.x86_64            18.03.0.ce-1.el7.centos             docker-ce-stable

启动Docker
# systemctl start docker

执行一个例子:
# docker run hello-world

输出如下表明docker安装成功了

Hello from Docker!

This message shows that your installation appears to be working correctly.

 

To generate this message, Docker took the following steps:

 1. The Docker client contacted the Docker daemon.

 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.

    (amd64)

 3. The Docker daemon created a new container from that image which runs the

    executable that produces the output you are currently reading.

 4. The Docker daemon streamed that output to the Docker client, which sent it

    to your terminal.

 

To try something more ambitious, you can run an Ubuntu container with:

 $ docker run -it ubuntu bash

 

Share images, automate workflows, and more with a free Docker ID:

 https://hub.docker.com/

 

For more examples and ideas, visit:

 https://docs.docker.com/engine/userguide/





 
posted @ 2018-08-27 19:58  沙琪玛  阅读(207)  评论(2编辑  收藏  举报