Redhat/Ubuntu/Windows下安装Docker

什么是Docker

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

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

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

在Redhat上安装Docker

确保系统上有curl命令

# yum install curl -y

下载并安装Docker

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

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

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

启动Docker

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

出现上面所述错误。。。

查看错误日志

# tail -f /var/log/docker
\nTue Apr 26 17:54:02 CST 2016\n
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."
time="2016-04-26T17:54:02.716238287+08:00" level=info msg="Listening for HTTP on unix (/var/run/docker.sock)"
/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

安装

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

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

下载链接:

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

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

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

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

# docker run hello-world

Ubuntu下安装Docker

确保系统中有curl命令

$ sudo apt-get update
$ sudo apt-get install curl -y

下载并安装Docker

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

启动Docker服务

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

$ sudo service docker status
docker start/running, process 7934

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

验证Docker是否正常工作

$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
03f4658f8b78: Pull complete
a3ed95caeb02: Pull complete
Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
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.
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 Hub account:
https://hub.docker.com For more examples and ideas, visit:
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

此处可能出现如下错误:

Error creating machine:Error in drive during machine creation: Unable to start the VM:...
...
Looks like something went wrong... Press any key to continue... 或 Error creating machine: Error in driver during machine creation: Maximum number of retries (5) exceeded
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. hibernate的三表查询

    表的关系: Cardgraderule      1:n     Cardgrade Cardgrade           1:n     Acardtype 实体类: public class C ...

  2. java-map和object装换

    /** * 使用org.apache.commons.beanutils进行转换 */ class A { public static Object mapToObject(Map<String ...

  3. POJ3249:Test for Job

    传送门 很简单的一道题,被卡了几次,死于答案非法统计. 题意是求图里的一条最长的路径满足起点的入度和终点的出度都是0,而且图是DAG. 既然是DAG求最长路,DP即可.搞出拓扑序,逆序DP,然后统计所 ...

  4. yii2 composer安装

    安装Yii2 1.安装composer 在命令行输入 curl-sS https://getcomposer.org/installer | php mv composer.phar /usr/loc ...

  5. Druid初步学习

    Druid是一个JDBC组件,它包括三部分:  DruidDriver 代理Driver,能够提供基于Filter-Chain模式的插件体系. DruidDataSource 高效可管理的数据库连接池 ...

  6. 获取APP最新版本的接口案例

    思路: 开发初期.安卓的应用可能没有上传到应用市场,可以把应用apk放到服务器上,供用户下载.把对应用的版本信息整理成为一个XML文件,放到服务器上,通过接口读取xml文件,获取有版本信息,然后安卓端 ...

  7. Angular-Chart.js 初接触;;;

    可以先看下下面的链接,了解下, 推荐链接 准备工作 JS文件{angular.js.Chart.js.angular-chart.js} 这3个文件我的获取难易程度:Chart.js > ang ...

  8. ML 基础知识

    A computer program is said to learn from experience E with respect to some task T and some performan ...

  9. [Hadoop] 在Ubuntu系统上一步步搭建Hadoop(单机模式)

    1 Hadoop的三种创建模式 单机模式操作是Hadoop的默认操作模式,当首次解压Hadoop的源码包时,Hadoop无法了解硬件安装环境,会保守地选择最小配置,即单机模式.该模式主要用于开发调试M ...

  10. C++ 修饰名的格式探究

    以下结果是由VS2010里面测试得出: ------------------------------------------------------------------ /* 函数名.类名.名称空 ...