CentOS7安装docker详细步骤

一、安装环境

[root@docker ~]# cat  /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

[root@docker ~]# uname  -r
3.10.0-327.4.5.el7.x86_64

二、添加docker的yum源

[root@docker ~]#  vim  /etc/yum.repos.d/docker.repo
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg

三、安装docker-engine

[root@docker ~]# yum install docker-engine   -y

四、启动docker

[root@docker ~]# systemctl start docker
[root@docker ~]# systemctl enable docker

五、测试docker是否安装正确

[root@docker ~]# docker  run hello-world

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
Status: Downloaded newer image for hello-world:latest

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/get-started/

  若能正常输出以上信息, 则说明安装成功。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章