在 Mac OS X 上安装 Docker(转)

http://www.oschina.net/translate/installing-docker-on-mac-os-x?print

在 Mac OS X 上安装 Docker

注意:Docker支持Mac OS X 10.6 "Snow Leopard" 及其以上版本.

Docker引擎使用了Linux内核特定的特性,所以要让它运行在OS X上我们需要用一个轻量型的虚拟机(vm)。用OS X的Docker客户端来控制虚拟Docker来构建,运行以及管理Docker容器。

为了使过程更简单一点,我们设计了一个叫做Boot2Docker的帮助应用程序,它能按照虚拟机以及运行Docker后台程序。

安装

  1. 下载最近版的Docker for OS X Installer

  2. 运行安装程序, 安装VirtualBox和Boot2Docker管理工具。   

  3. 运行应用程序文件夹下的Boot2Docker应用:   

或者手动初始化Boot2Docker,打开终端并运行:

1      $ boot2docker init
2      $ boot2docker start
3      export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375

 

一旦你初始化化好了一个虚拟机,你就能用boot2docker stop和boot2docker start来进行控制。

更新

  1. 下载最新版的Docker for OS X Installer

  2. 运行安装程序, 更新VirtualBox和Boot2Docker管理工具。

  3. 更新现有虚拟机,打开终端并运行:

    1 $ boot2docker stop
    2 $ boot2docker download
    3 $ boot2docker start

     

运行Docker

在终端上跑一个“hello world” 的示例来测试Docker。启动虚拟机然后运行:

1 $ docker run ubuntu echo hello world

 

这样应该会下载ubuntu镜像并打印hello world。

容器端口跳转

最新版的boot2docker建立了一个仅有网络适配器的主机提供可以接入容器的端口。

如果你运行一个有公开端口的容器,

1 $ docker run --rm -i -t -p 80:80 nginx

 

然后你应该能用IP地址接入Nginx服务器:

1 $ boot2docker ip

 

通常,这个IP地址为192.168.59.103,但是也可能被VirtualBox启用的DHCP修改。

更多细节

如果你好奇的话,Boot2Docker的缺省用户名为docker,密码为tcuser。

Boot2Docker管理工具提供了很多命令:

$ ./boot2dockerUsage: ./boot2docker [<options>]{help|init|up|ssh|save|down|poweroff|reset|restart|config|status|info|ip|delete|download|version} [<args>]

 

更多内容在User Guide

想了解更多信息或者报告问题,请访问Boot2Docker site

来源:http://www.cnblogs.com/yaoliang11/p/4429307.html


智能推荐

mac os 安装docker

brew install docker brew install docker-machine brew services start docker-machine brew install virtualbox # Requires SystemPreferences intervention docker-machine create default --virtualbox-cpu-coun...

mac -> WMware 安装 MAc OS X Lion

 VMware 8 安装好,  MAC Lion  .ios 拿到手, 然后 管理员身份安装  Vmware 的  MAC 补丁 (附件unlock-all-v102.zip 杀毒软件会提示有木马)     然后 运行  虚拟器 ,  灰色背景苹果图标(等好久)-》 菊花转(等好久)    ...

在苹果MAC OS X Lion系统上使用Outlook for MAC 2011配置Exchange邮箱

前期准备 域帐号“登录到”计算机准备 1. 点击“苹果按钮”、“系统偏好设置”、选择“共享”。如图1、2。 图1 图2 2. 将MAC系统的计算机名告知负责AD域服务器的管理员,以便将计算机名和域帐号进行登录绑定。如图3。 图3 注:如果您的环境中没有此计算机登录限制,请忽略。 Outlook准备 请确...

scala mac安装_在Mac OS上安装Scala

scala mac安装 不久前,我决定使用一种新的编程语言来提高自己的编程技能。 正如您看到的那样,新语言是Scala。 我不想写很多关于Scala优势的段落,这对我的决定至关重要。 学习任何编程语言都是从环境搭建开始的 。 在这篇文章中,我将概述Mac OS上Scala的安装。 此外,我将写同样的文章,但适用于Windows。 足够多的话,让我们继续实践步骤。 从官方网站下载scala-X.XX...

在 Mac OS X 上创建可引导的 Ubuntu U盘

   发表于 2016-07-20 |  分类于 Server |  前言 以前在遥远的使用 Windows 的年代,经常使用 UltraISO 来把 ISO 镜像写入U盘,来从U盘引导系统。换了 Mac 以后,偶尔还是会用 VMware 虚拟机来使用 UltraISO 将 ISO 镜像写...

猜你喜欢

hadoop2.x 伪集群搭建

作者:穿越   -- 教程来源于网络,回归于网络 前置准备 1 分析 Hadoop 2.0 里的 HA实现方式。作为了解, 如下图:  图片来源于网络 HA(High Available):高可用性集群,是保证业务连续性的有效解决方案,一般有两个或两个以上的节点,且分为活动节点及备用节点。 ZK(Zookeeper):用作NN的高活框架 ZKFC(ZooKeeper ...

Net设计模式之抽象工厂模式(Abstract Factory Pattern)(2)

四.案例分析(Example) 1、场景 使用抽象工厂+反射+配置文件实现数据访问层程序。结构如下图所示   用反射+抽象工厂+配置文件的数据访问程序。 Assembly.Load("程序集名称").CreateInstance("命名空间.类名称")。比如: IProduct product=(IProduct)Assembly.Load(&qu...

玩转Zynq连载13——使用GIT进行工程备份和版本管理5

特权同学玩转Zynq连载13——使用GIT进行工程备份和版本管理5 2.5查看旧版本的文件 Show Log命令查看本地版本信息,选中需要查看的旧版本,如这里选中ver1,右键单击并选中命令Reset “master” to this …。 弹出如下Reset界面,勾选Commit和Hard:Reset working tree and...

强行复习第三天:c语言(下)

说好的段位难道不刷了嘛。。。。 复习归复习,题还是要刷啊喂! 明天就开始上课了。。。时间越来越紧了。。。   公众号里好多该更新的都没更。。。欠了一个app推荐,欠了一个流浪地球影评,欠了个黑寡妇个人向分析,还有一个预支出去了的复联四。。。 哦,对了,还想写一个乐园系列来着,仙女乐园写完了,还有妖精乐园想写。。。外加还想推荐点男歌手来着了。。。 林俊杰也没写。。 那个很棒的对比向idea...

编程集训 day02 linked list

midterm 前夕作业有点多,写的简单点。。。 Linked list cycle II solution 1 result solution2 result 2. reverse linked list solution result...

问答精选

Is this a good way to stream data through django channels?

I have a database where new data is being inserted every second. When the websockets connection is first established, I want to send all the data using django channels. Then, I want the new data data ...

JUnit theories sets params to null

I have a test class that using theories like this: I don't understand why I am getting x as null. I tried the same with parameterized tests and still null. What am I missing here? The problem within y...

How to disable Android home and back button from Delphi

I'm writing an app for an Android tablet in Delphi XE7. I want to turn off home and back button so no one can leave the application. I have found many answers, but none refers to Delphi. How can I ach...

Typescript generic function accept object that has first argument as a key

I want to make a function that accepts a string first argument, and then will only accept a second object argument if it has the first argument as a key, with a boolean value: This works but is undesi...

About headers, forwards and how to organize a lot of includes

I have 3 classes (it could be 300) , each one with its own header and implementation. I'd like to write an 'elegant' way to organize the way I load of any class needed by every class of the three. May...

相关问题

相关文章

热门文章

推荐文章

相关标签

推荐问答