前提条件

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. SpringBoot实战(十)之使用Spring Boot Actuator构建RESTful Web服务

    一.导入依赖 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http ...

  2. java把行政区划放到一个节点树形中

    作者原创:转载请注明出处.https://www.cnblogs.com/yunqing/p/9486923.html 先放数据,t_city表 //津京冀地区行政区划数据 SET FOREIGN_K ...

  3. [转]MVVM架构~mvc,mvp,mvvm大话开篇

    MVP 是从经典的模式MVC演变而来,它们的基本思想有相通的地方:Controller/Presenter负责逻辑的处理,Model提供数据,View负 责显示.作为一种新的模式,MVP与MVC有着一 ...

  4. 支付宝在ios应用上的开发[转]

    前奏 现在随着移动开发的快速发展,越来越多的应用要求在线支付功能.最近做了一个关于支付宝支付功能的应用,在使用支付宝的过程中,遇到一些不必要的弯路,因此,写了这篇文章总结一下关于ios开发如何使用支付 ...

  5. SharePoint客户端对象模型—任务日历生成

    1,憋了好几天在经理帮助下用Js根据任务列表,生成的个人任务日历. (1)需要用到的CSS样式 <style type="text/css"> th.ms-vh { c ...

  6. git提交代码到码云

    日常代码一般提交到github比较多,但我还是钟爱马爸爸,没错就是码云. 码云是中文版的代码托管的网站,不存在打开网速问题,使用也蛮方便的,日常自己保存托管代码已经足够,平时使用git提交代码到码云是 ...

  7. Set集合之TreeSet类

    TreeSet简介 TreeSet是SortedSet接口的实现类,正如SortedSet名字所暗示的,TreeSet可以确保集合元素处于排序状态.与HashSet集合相比,TreeSet还提供了如下 ...

  8. angular setInterval计时操作

    在angular中setInterval方法是单向绑定,只绑定一次,无法实现计时效果, 可以使用$interval实现.附上代码:

  9. thinkPHP写txt日志文件

     file_put_contents(DATA_PATH.'文件名.txt', '收到请求:' . date('Y-m-d H:i:s') . PHP_EOL . '通知信息:' . $显示的变量名. ...

  10. day 35初识数据库

    一.数据库概述 1.什么是数据库?先来看看百度怎么说的. 数据库,简而言之可视为电子化的文件柜——存储电子文件的处所,用户可以对文件中的数据运行新增.截取.更新.删除等操作.     所谓“数据库”系 ...