您的位置:首页 > 运维架构 > Docker

在你的Mac上安装Docker Toolbox

2016-02-15 19:53 716 查看
Mac用户需要使用Docker 工具箱来安装Docker,Docker工具箱包含以下docker工具:

Docker CLI 客户端以运行Docker引擎来创建镜像和容器

Docker Machine来运行Mac终端中的Docker引擎命令行

Docker Compose来运行 docker-compose命令

Kitematic, Docker的 GUI

针对Docker命令行环境的快速启动脚本预定义

Oracle VM VirtualBox

因为Docker Engine daemon 使用Linux内核守护进程,所以你不能原生的在Mac上使用Docker Engine,必须要使用Docker Machinecommand在你本机创建和连接一个Linux虚拟机,给你本机使用的一个虚拟主机Docker引擎。

第一步:检查你的系统版本

操作系统必须为OS X10.8“Mountain Lion” 或更高版本才能运行Docker。看看你自己的操作系统版本号:

1.查看你的关于本机:



2.如果你的操作系统满足条件,你可以执行下一步。

如果你没有使用支持的版本,也许你可以考虑升级你的操作系统。

第二步:安装Docker工具箱

1.下载Docker toolBox 这是下载地址https://www.docker.com/products/docker-toolbox

2.双击安装包安装



3.点击继续以 安装

安装程序会为您提供的选项来定制规范安装。



4.点击安装,会需要输入密码来确定安装,输入你的密码来等待安装完成。

5.点击继续,然后关闭。





第三步:验证你的安装

为了运行一个Docker容器,你应该:

创建一个新的(或者启动一个已存在的)Docker引擎并运行

把环境切换到新的虚拟机

使用Docker客户端来创建,加载和管理容器

一旦你创建了一台机器,你可以随便重复使用,像任何虚拟机一样,它会保持它配置之间的通用。

1.打开启动 并找到图标



2.单击图标Docker Quickstart Termina 运行窗口

这个终端会为你打来Docker做很多事情

Last login: Sat Jul 11 20:09:45 on ttys002

bash ‘/Applications/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh’

Get http:///var/run/docker.sock/v1.19/images/json?all=1&filters=%7B%22dangling%22%3A%5B%22true%22%5D%7D: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

Get http:///var/run/docker.sock/v1.19/images/json?all=1: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

-bash: lolcat: command not found

mary at meepers in ~

$ bash ‘/Applications/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh’

Creating Machine dev…

Creating VirtualBox VM…

Creating SSH key…

Starting VirtualBox VM…

Starting VM…

To see how to connect Docker to this machine, run: docker-machine env dev

Starting machine dev…

Setting environment variables for machine dev…

##         .
## ## ##        ==
## ## ## ## ##    ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
\______ o           __/
\    \         __/
\____\_______/
The Docker Quick Start Terminal is configured to use Docker with the “default” VM.


3.将你的鼠标移到终端上并点击

如果你不是很会使用终端的话,这里有一些快速入门的小技巧提供给你:



提示是一个传统的美元美元符号。你在命令行键入的命令是在提示之后的区域。当前位置的光标会高亮显示或|显示在命令行。输完命令之后,按回车来执行。

4.输入docker run hello-world命令并按回车.

如果命令生效了并正常运行,它的输出结果如下:

$ docker run hello-world

Unable to find image ‘hello-world:latest’ locally

latest: Pulling from library/hello-world

535020c3e8ad: Pull complete

af340544ed62: Pull complete

Digest: sha256:a68868bfe696c00866942e8f5ca39e3e31b79c1e50feaee4ce5e28df2f051d5c

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 Engine CLI client contacted the Docker Engine daemon.

2. The Docker Engine daemon pulled the “hello-world” image from the Docker Hub.

3. The Docker Engine daemon created a new container from that image which runs the

executable that produces the output you are currently reading.

4. The Docker Engine daemon streamed that output to the Docker Engine CLI 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/

需要疑难解答帮助?

通常情况下,上述步骤不会出问题,但某些情况下却有可能导致出现问题。如果你的Docker run hello world没有工作并出现错误,你可以查看故障检修快速修复常见问题。

下一步

现在你已经成功的安装了Docker. 让Docker Quickstart Terminal 窗口开着吧.现在来看下 Docker镜像和容器的简介
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: