前提条件

Docker 运行在 CentOS 7 上,要求系统为64位、系统内核版本为 3.10 以上。

Docker 运行在 CentOS-6.5 或更高的版本的 CentOS 上,要求系统为64位、系统内核版本为 2.6.32-431 或者更高版本。

首先, 查看系统是否支持:

Docker有两种方式安装:

  1. 脚本安装
  2. Yum包安装

安装前注意:

  1. 本文针对CentOS 7 去安装
  2. 如果太久或者是特殊系统不要yum update
  3. 必需要root权限

一、Yum包安装

(1) 添加 docker,Yum源
[root@localhost ~]# sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
> [dockerrepo]
> name=Docker Repository
> baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
> enabled=1
> gpgcheck=1
> gpgkey=https://yum.dockerproject.org/gpg
> EOF
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
(2) 安装 docker包
[root@localhost ~]# yum install docker-engine
(3) 启动守护 docker进程
[root@localhost ~]# service docker start
Redirecting to /bin/systemctl start docker.service
(4) 测试
[root@localhost ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:97ce6fa4b6cdc0790cda65fe7290b74cfebd9fa0c9b8c38e979330d547d22ce1
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://cloud.docker.com/ For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
(5) 镜像加速 (可选)
 vim /etc/docker/daemon.json

{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}
(6) 开机启动
[root@localhost ~]# systemctl enable docker.service

二、脚本安装 (感觉不太靠谱, 不推荐)

(1)  yum update

(2)  curl -sSL https://get.docker.com/ | sh

(3)  service docker start

(4)  docker run hello-world

启动时候会出现的错误:

Job for docker.service failed. See 'systemctl status docker.service' and 'journalctl -xn' for details.

1: 防火墙之类的,

2: yum -y install docker

推荐文档:

http://www.runoob.com/docker/centos-docker-install.html

http://www.docker.org.cn/book/install/supported-platform-17.html

【CentOS】安装Docker教程的更多相关文章

  1. Linux--CentOS 安装 Docker 教程

    本文主要介绍 CentOS 系统安装 Docker 的流程. 前提条件 OS 要求 CentOS7: The centos-extras repository must be enabled. Thi ...

  2. 手把手教centos安装docker

    目录 版本说明 官网安装教程 安装docker 现在网络上安装教程满天飞,很大一部分是别人的总结,可以说是成果,却没有介绍如何去实现这个成果方法.这篇就结合官网教程来聊聊如何在centos上安装doc ...

  3. centos安装docker容器

    centos安装docker容器 系统环境需求 docker要运行在centos7系统中,系统为64位机器上,内核最小版本在3.10以上 如果系统为centos6,后面有附带的安装方法 uname - ...

  4. 【实战】Docker 入门实战一:ubuntu 和 centos 安装Docker

    Docker是什么 Docker 是一个开源的应用容器引擎,基于 Go 语言 并遵从Apache2.0协议开源.Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级.可移植的容器中,然后发布 ...

  5. ubuntu和centos安装docker

    一. UBUNTU系统上 1. 卸载旧版本(新系统不用执行) sudo apt-get remove docker docker-engine docker.io     2. 安装docker st ...

  6. Centos安装smokeping教程

    Centos安装smokeping教程 一 .安装基本依赖包 ntpdate time.windows.com #64bit rpm -Uhv http://apt.sw.be/redhat/el6/ ...

  7. CentOS安装docker,及其基本操作

    CentOS安装docker,及其基本操作 一.安装docker Docker要求运行在Centos 7上,要求系统为64位,系统内核版本3.10以上 1.uname -an 查看当前系统版本 2.y ...

  8. CentOS安装docker ce的三种方式

    参考文章: CentOS安装docker ce的三种方式: 1.环境 CentOS Linux release 7.6.1810 (Core) 2.卸载旧版本 sudo yum remove dock ...

  9. 5分钟安装docker教程

    Centos安装docker需要操作系统是 CentOS 7 or 8,必须启用centos extras存储库.默认情况下,此存储库处于启用状态,但如果已禁用它,则需要重新启用它. 卸载旧版本 老版 ...

随机推荐

  1. PHP扩展功能 ---- 页面静态化(OB缓冲)

    一.入门三部曲 1.什么是页面静态化 百度百科介绍: 静态页面是网页的代码都在页面中,不需要执行asp,php,jsp,.net等程序生成客户端网页代码的网页,静态页面网址中一般不含"?&q ...

  2. angularjs ng-if ng-show ng-hide区别

    在使用anularjs开发前端页面时,常常使用ng-show.ng-hide.ng-if功能来控制页面元素的显示或隐藏,那他们之间有什么不同呢? 实现原理方面:ng-show/ng-hide是通过修改 ...

  3. [LuoguP1221]最多因子数

    [Luogu1221]最多因子数(Link) 求区间[L,R]内约数个数最多的数和它的约数个数. 这个题吧,乍一看确实不是很难,然后稍微一想,嗯,是个傻*题.这是唯一感受,不要问我为什么. 首先我们定 ...

  4. iOS 关闭图片渲染

    在为Button 设置背景图片的时候, 会发现显示的效果和UI给的图片不一样, 往往是把图片显示成为蓝色, 这是因为在新版的iOS中, 会自动对图片渲染. 我们只要把图片渲染关掉就OK了 - (UII ...

  5. ListView 中的TextView实现跑马灯效果

    案例:怎么样在一个ListView中含有TextView的item中实现字母滚动呢.这个在一些特定的场合经常用得到.如下图,当焦点位于某个item的时候其内容就自动滚动显示 要实现这样的效果,废话不多 ...

  6. Java SSM 客户管理 商户 管理系统 库存管理 销售报表 项目源码

    系统介绍: 1.系统采用主流的 SSM 框架 jsp JSTL bootstrap html5 (PC浏览器使用) 2.springmvc +spring4.3.7+ mybaits3.3  SSM ...

  7. C++的六个函数

    一.构造函数 在C++中,构造函数是六个函数中的第一个,当一个对象被创建时,在它的整个周期中,是一个由生到死的 过程,即构造函数创建对象,析构函数析构对象.在对象被创建时,调用构造函数创建一个对象,这 ...

  8. CentOS 7紧急救援模式修改root用户密码的方法

    最近无聊在网上搜索linux系统root用户密码破解方法,看来很多朋友的博文,同时也试了一下,但是感觉他们写的还是不是很清晰.简洁,因此自己就心血来潮写了这篇博文,提供一个比较清晰的思路给新手,如果有 ...

  9. es6 入坑笔记(四)---异步处理

    promise 用于js的异步处理 形式: 1.申明一个promise的对象 let p = new Promise(function(成功时的参数,失败时的参数){ if(....){ 成功时的参数 ...

  10. 用file标签实现多图文件上传预览

    效果图: js 代码: <script> //下面用于多图片上传预览功能 function setImagePreviews(avalue) { var docObj = document ...