centos 7 安装docker

1. 环境准备

查看内核

uname -r  (3.10.0-693.el7.x86_64)

版本在3.10以上才行。

2. docker安装

目前红帽RHEL系统下面安装docker可以有两种方式:一种是使用curl获得docker的安装脚本进行安装,还有一种是使用yum包管理器来安装docker。

我们采用第一种方式curl 

2.1 脚本安装

$ curl -sSL https://get.docker.com/ | sh 

2.2 启动docker服务

$ sudo service docker start

 2.3 确认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/

 2.4 如果想用非root用户运行docker,添加用户到docker组即可

$ usermod -aG docker your_username

 

posted @ 2019-01-12 17:04  duaner92  阅读(128)  评论(0编辑  收藏  举报