Redhat/Ubuntu/Windows下安装Docker

什么是Docker

Docker是Docker.inc公司开源的一个基于LXC技术之上构建的Container容器引擎,基于Go语言并遵从Apache2.0协议开源。

开发者可以搭建他们的应用仅仅一次,就能保证让这个应用保持一致的跑在任何地方。运营人员可以将他们的服务器配置一边,就能跑任何应用。

Docker官网:http://www.docker.com/

在Redhat上安装Docker

确保系统上有curl命令

  1. # yum install curl -y

下载并安装Docker

  1. # curl -fsSL https://get.docker.com/ | sh
  2. + sh -c 'sleep 3; yum -y -q install docker-engine'

出现下面的输出说明安装成功。

  1. This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
  2. warning: rpmts_HdrFromFdno: Header V4 RSA/SHA1 Signature, key ID 2c52609d: NOKEY
  3. Importing GPG key 0x2C52609D:
  4. Userid: "Docker Release Tool (releasedocker) <docker@docker.com>"
  5. From : https://yum.dockerproject.org/gpg
  6. If you would like to use Docker as a non-root user, you should now consider
  7. adding your user to the "docker" group with something like:
  8. sudo usermod -aG docker your-user
  9. Remember that you will have to log out and back in for this to take effect!

启动Docker

  1. # /etc/init.d/docker start
  2. # /etc/init.d/docker status
  3. docker dead but pid file exists

出现上面所述错误。。。

查看错误日志

  1. # tail -f /var/log/docker
  2. \nTue Apr 26 17:54:02 CST 2016\n
  3. time="2016-04-26T17:54:02.715286173+08:00" level=warning msg="You are running linux kernel version 2.6.32-431.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.10.0."
  4. time="2016-04-26T17:54:02.716238287+08:00" level=info msg="Listening for HTTP on unix (/var/run/docker.sock)"
  5. /usr/bin/docker: relocation error: /usr/bin/docker: symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference

在错误日志中发现version Base not defined in file libdevmapper.so.1.02 with link time reference,缺少libdevmapper.so.1.02

安装

  1. # yum install libdevmapper.so.1.02 -y
  2. # /etc/init.d/docker restart
  3. Stopping docker: [FAILED]
  4. Starting docker: [ OK ]

查看日志,发现还是之前的错误,原因在于自带的软件版本太低,自己下载就好了。如下:

下载链接:

device-mapper-libs-1.02.95-2.el6.x86_64.rpm

device-mapper-1.02.95-2.el6.x86_64.rpm

  1. # rpm -ivh device-mapper-1.02.95-2.el6.x86_64.rpm device-mapper-libs-1.02.95-2.el6.x86_64.rpm --force
  2. # /etc/init.d/docker restart
  3. # /etc/init.d/docker status
  4. docker (pid 5607) is running...

至此,我们的Docker就安装好了,那让我们来验证一下吧

  1. # docker run hello-world

Ubuntu下安装Docker

确保系统中有curl命令

  1. $ sudo apt-get update
  2. $ sudo apt-get install curl -y

下载并安装Docker

  1. $ sudo curl -fsSL https://get.docker.com/ | sh

启动Docker服务

其实在Ubuntu中安装Docker后会默认启动Docker,你可以使用sudo service docker status查看

  1. $ sudo service docker status
  2. docker start/running, process 7934

如果需要手动启动或者重启Docker可以使用sudo service docker startsudo service docker restart

验证Docker是否正常工作

  1. $ sudo docker run hello-world
  2. Unable to find image 'hello-world:latest' locally
  3. latest: Pulling from library/hello-world
  4. 03f4658f8b78: Pull complete
  5. a3ed95caeb02: Pull complete
  6. Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
  7. Status: Downloaded newer image for hello-world:latest
  8. Hello from Docker.
  9. This message shows that your installation appears to be working correctly.
  10. To generate this message, Docker took the following steps:
  11. 1. The Docker client contacted the Docker daemon.
  12. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
  13. 3. The Docker daemon created a new container from that image which runs the
  14. executable that produces the output you are currently reading.
  15. 4. The Docker daemon streamed that output to the Docker client, which sent it
  16. to your terminal.
  17. To try something more ambitious, you can run an Ubuntu container with:
  18. $ docker run -it ubuntu bash
  19. Share images, automate workflows, and more with a free Docker Hub account:
  20. https://hub.docker.com
  21. For more examples and ideas, visit:
  22. https://docs.docker.com/userguide/

出现上面的部分,则安装成功

Windows下安装Docker

要在Windows下运行Docker,要求操作系统一定要是Win7及以上版本的64位操作系统,另外,你必须确保你的电脑支持硬件虚拟化技术并且已经开启该功能。

下载Docker Toolbox

下载链接:

https://www.docker.com/products/docker-toolbox

安装Docker Toolbox

运行DockerToolbox安装包

点击“Next”

点击”Browse…”选择安装位置,然后点击”Next”

选择所要安装的组件,如果你的电脑上已经安装了某些组件可以把对应的勾号去掉,然后点击”Next”(我电脑上原本已经安装有Git,所以将Git前的勾号去掉)

点击”Next”

点击”Install”

等待安装完成….

点击”Finish”完成安装

该安装包安装完成后,系统上会多出三个软件(如果选择安装所有组件的话):

  • Oracle VM VirtualBox
  • Git
  • Boot2Docker for Windows

桌面上将会多出三个图标:

启动Docker

打开文件资源管理器,切到Docker的安装目录下

运行start.sh

此处可能出现如下错误:

  1. Error creating machine:Error in drive during machine creation: Unable to start the VM:...
  2. ...
  3. Looks like something went wrong... Press any key to continue...
  4. Error creating machine: Error in driver during machine creation: Maximum number of retries (5) exceeded
  5. Looks like something went wrong... Press any key to continue...

解决方法:

http://superuser.com/questions/996785/docker-toolbox-error-creating-machine-error-in-driver-during-machine-creation

参考链接:

http://xautlmx.github.io/2016-03-13-RedHat-Ubuntu-Windows%E4%B8%8B%E5%AE%89%E8%A3%85Docker.html#more

Redhat/Ubuntu/Windows下安装Docker的更多相关文章

  1. Docker学习系列(一):windows下安装docker(转载)

    本文目录如下: windows按照docker的基本要求 具体安装步骤 开始使用 安装远程连接工具连接docker 安装中遇到的问题 Docker的更新 Docker中的jupyter windows ...

  2. windows下 安装docker

    一.Docker 1.什么是docker 对比 特性 容器 虚拟机 启动 秒级 分钟级 磁盘使用 一般为MB 一般为GB 性能 接近原生 弱于 系统支持量 单机支持上千个容器 一般几十个 2. 使用d ...

  3. Docker学习のWindows下安装Docker

    一.docker最初只支持linux的,因此在windows下运行需要虚拟机. 利用VirtualBox建立linux虚拟机,在linux虚拟机中安装docker服务端和客户端 利用Windows的H ...

  4. (转)Windows下安装Docker, GitBash环境配置

    转:https://blog.csdn.net/chengly0129/article/details/68944269 官网介绍: https://docs.docker.com/toolbox/t ...

  5. Windows下安装Docker

    放在三年前,你不认识Docker情有可原,但如果现在你还这么说,不好意思,只能说明你OUT了,行动起来吧骚年,很可能你们公司或者你即将要去的公司,或者你想去的公司很可能就会引入Docker,或者已经引 ...

  6. Docker的学习(一)Windows下安装docker环境以及基础的配置

    Docker是什么我这里就不多做介绍了,相信大家都清楚,网上有很多介绍的文章所以作为菜鸟的我就不用我的眼光以及理解来为大家介绍了,还是那句话,这篇文章主要是用作记录学习过程,希望不会误导新人,也希望各 ...

  7. Ubuntu 环境下安装 Docker

    系统要求 Docker目前只能运行在64位平台上,并且要求内核版本不低于3.10,实际上内核越新越好,过低的内核版本容易造成功能不稳定. 用户可以通过如下命令检查自己的内核版本详细信息: $ unam ...

  8. ubuntu环境下安装docker遇到的坑

    ubuntu安装docker的前提条件是: 1. Linux 的内核版本在 3.10 或以上: 2. linux 内核要开启 cgroup 和 namespace 功能 可以执行命令:uname –a ...

  9. windows 下安装 docker

    1. 使用阿里云的镜像进行安装: http://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/ 2. 安装完成后点击图标 “Dock ...

随机推荐

  1. 在 MAC OS X 安装 ADB (Android调试桥)

    什么是 ADB? Android调试桥( adb )是一个开发工具,帮助安卓设备和个人计算机之间的通信. 这种通信大多是在USB电缆下进行,但是也支持Wi-Fi连接. adb 还可被用来与电脑上运行的 ...

  2. 使用属性动画 — Property Animation

    属性动画,就是通过控制对象中的属性值产生的动画.属性动画是目前最高级的2D动画系统. 在API Level 11中添加.Property Animation号称能控制一切对象的动画,包括可见的和不可见 ...

  3. Poisson泊松分布

    PMF 若随机变量\(K\)的概率质量函数PMF为 \[ P(K = k) = e^ {-\lambda} \frac {\lambda^k}{k!} \] 则称:\(K \sim Poisson(\ ...

  4. 让你Android开发更简单

    转载:http://www.jianshu.com/p/22ff8b5fdadc 搭建一个新的Android项目,你会怎么做? 每个人对应用框架的理解不相同,但是最终达到的效果应该是一样: ①降低项目 ...

  5. ASP.NET MVC中viewData、viewBag和templateData的使用与区别

    一:类型比较 1.1)ViewBag是动态类型(dynamic). 1.2)ViewData是一个字典型的(Dictionary)-->ViewDataDictionary. 1.3)TempD ...

  6. please wait while windows configures microsoft visual studio professional 2013 [转载]

    2016年5月30日 VS3013安装update 2以后,打开offie出现"please wait while windows configures microsoft visual s ...

  7. 对前端的一个H5项目的所思所想

    最近接触一个前端HTML5的项目,虽然我主做iOS,但曾经也徒手用html+css+js+php写过一个博客,当然表示无压力了.结果.现在的前端发展的速度真是快啊,项目中用到Jquery,reactJ ...

  8. <<< PermGen space溢出解决方法

    错误信息中的PermGen space的全称是Permanent Generation space,是指内存的永久保存区域.还没有弄明白PermGen space是属于非堆内存,还是就是非堆内存,但至 ...

  9. WebUploader UEditor chrome 点击上传文件选择框会延迟几秒才会显示 反应很慢

    chrome52.0.2743.80以上, accept: { title: 'Images', extensions: 'jpg,jpeg,png', mimeTypes: 'image/*' } ...

  10. Java递归算法——三角数字(消除递归)

    import java.io.*; // for I/O //类名:Params //属性: //方法: class Params //这个类的对象被压入栈中 { public int n; //用来 ...