Redhat/Ubuntu/Windows下安装Docker
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 start
或sudo 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://xautlmx.github.io/2016-03-13-RedHat-Ubuntu-Windows%E4%B8%8B%E5%AE%89%E8%A3%85Docker.html#more
Redhat/Ubuntu/Windows下安装Docker的更多相关文章
- Docker学习系列(一):windows下安装docker(转载)
本文目录如下: windows按照docker的基本要求 具体安装步骤 开始使用 安装远程连接工具连接docker 安装中遇到的问题 Docker的更新 Docker中的jupyter windows ...
- windows下 安装docker
一.Docker 1.什么是docker 对比 特性 容器 虚拟机 启动 秒级 分钟级 磁盘使用 一般为MB 一般为GB 性能 接近原生 弱于 系统支持量 单机支持上千个容器 一般几十个 2. 使用d ...
- Docker学习のWindows下安装Docker
一.docker最初只支持linux的,因此在windows下运行需要虚拟机. 利用VirtualBox建立linux虚拟机,在linux虚拟机中安装docker服务端和客户端 利用Windows的H ...
- (转)Windows下安装Docker, GitBash环境配置
转:https://blog.csdn.net/chengly0129/article/details/68944269 官网介绍: https://docs.docker.com/toolbox/t ...
- Windows下安装Docker
放在三年前,你不认识Docker情有可原,但如果现在你还这么说,不好意思,只能说明你OUT了,行动起来吧骚年,很可能你们公司或者你即将要去的公司,或者你想去的公司很可能就会引入Docker,或者已经引 ...
- Docker的学习(一)Windows下安装docker环境以及基础的配置
Docker是什么我这里就不多做介绍了,相信大家都清楚,网上有很多介绍的文章所以作为菜鸟的我就不用我的眼光以及理解来为大家介绍了,还是那句话,这篇文章主要是用作记录学习过程,希望不会误导新人,也希望各 ...
- Ubuntu 环境下安装 Docker
系统要求 Docker目前只能运行在64位平台上,并且要求内核版本不低于3.10,实际上内核越新越好,过低的内核版本容易造成功能不稳定. 用户可以通过如下命令检查自己的内核版本详细信息: $ unam ...
- ubuntu环境下安装docker遇到的坑
ubuntu安装docker的前提条件是: 1. Linux 的内核版本在 3.10 或以上: 2. linux 内核要开启 cgroup 和 namespace 功能 可以执行命令:uname –a ...
- windows 下安装 docker
1. 使用阿里云的镜像进行安装: http://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/ 2. 安装完成后点击图标 “Dock ...
随机推荐
- git远程仓库
git远程仓库: 目前我们使用到的 Git 命令都是在本地执行,如果你想通过 Git 分享你的代码或者与其他开发人员合作. 你就需要将数据放到一台其他开发人员能够连接的服务器上. 添加远程仓库: gi ...
- spring 整合 mongo
spring 非常强大,不仅在jdbc访问提供了jdbctemplate,而且在mongo访问上提供了mongoTemplate.闲话不多说,下边开始整合mongoTemplate. ONE: 添加s ...
- java/python中的队列
Queue<TreeNode> que=new LinkedList<>(); 用linkedlist实现队列,offer,poll进出队列,peek对列顶部元素 python ...
- TCP协议中的三次握手和四次挥手(图解)
建立TCP需要三次握手才能建立,而断开连接则需要四次握手.整个过程如下图所示: 先来看看如何建立连接的. 首先Client端发送连接请求报文,Server段接受连接后回复ACK报文,并为这次连接分配资 ...
- Jquery 关于span标签的取值赋值用法
span是最简单的容器,可以当作一个形式标签,其取值赋值方法有别于一般的页面元素. //赋值 $("#spanid").html(value) //取值 $("#span ...
- 【BZOJ-2669】局部极小值 状压DP + 容斥原理
2669: [cqoi2012]局部极小值 Time Limit: 3 Sec Memory Limit: 128 MBSubmit: 561 Solved: 293[Submit][Status ...
- 为什么npm install在安装时会多安装很多依赖包
比如我安装gulp时,会多出很多无用的包,如下图: 经过查询,原来是npm升级了导致的,在npm3.0以上的版本,包的依赖不再安装在每个架包的node_modules文件夹内,而是安装在顶层的node ...
- phpexcel导入数据部分数据有误
数据在excel中是这样的: 插入数据库后是这样的: 很难发现,出错的那几条数据中的单元格中都有英文','符号,而phpexcel又是以','来拼接读取到的数据的. 解决办法:修改代码中的','为不常 ...
- CentOS 6.7下利用Rsyslog+LogAnalyzer+MySQL部署日志服务器
一.简介 LogAnalyzer 是一款syslog日志和其他网络事件数据的Web前端.它提供了对日志的简单浏览.搜索.基本分析和一些图表报告的功能.数据可以从数据库或一般的syslog文本文件中获取 ...
- linux下重启apache
基本的操作方法: 本文假设你的apahce安装目录为/usr/local/apache2,这些方法适合任何情况 apahce启动命令: 推荐/usr/local/apache2/bin/apachec ...