温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

在Mac OS X怎么安装Docker

发布时间:2022-05-26 15:04:12 来源:亿速云 阅读:341 作者:iii 栏目:大数据

这篇“在Mac OS X怎么安装Docker”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“在Mac OS X怎么安装Docker”文章吧。

mac os x用户使用docker toolbox安装docker软件, docker toolbox包含了下列的docker 工具:

  • docker cli客户端, 用来运行docker engine,并创建镜像和容器

  • docker machine, 在mac os x终端运行docker engine命令

  • docker compose, 用来运行docker-compose命令

  • kitematic, docker图形用户界面

  • docker quickstart, 快速启动docker命令行环境的shell

  • oracle vm virtualbox

由于docker engine守护进程使用特定的linux内核的功能, 你无法再本地的os x运行docker engine, 与之代替的是你必须使用docker machine命令docker-machine在你本地的机器创建并连接一个小型的linux虚拟机. 这个就在你mac上的虚拟主机就是docker machine.

第一步,检查版本

你的mac必须运行os x 10.8 “mountain lion”或以上的系统才能运行docker, 你可以这样查看os的版本:

1、从苹果菜单中选择”关于本机”

在Mac OS X怎么安装Docker

2、如果你的版本正确,就可以进行下一步了

如果你没有使用支持的版本,你需要考虑先升级的你操作系统

第二步,安装docker toolbox

1、访问docker toolbox

2、点击下载链接

3、通过双击下载的安装包, 或者右键安装包在弹出的菜单中选择”打开”, 来安装docker toolbox

安装程序将启动一个介绍对话框,介绍安装内容的概述。

在Mac OS X怎么安装Docker

4、点击”继续”安装toolbox

安装程序为你提供了选项, 自定义标准安装

在Mac OS X怎么安装Docker

默认的, 标准的docker toolbox安装:

  • 为docker 工具在/usr/local/bin安装二进制文件

  • 使这些二进制文件对所有用户可用

  • 更新已经存在的virtual box

现阶段, 不要修改任何的默认选线

5、点击”安装”, 执行标准安装

系统会提示你输入密码

在Mac OS X怎么安装Docker

输入你的密码, 继续完成安装

当它完成后,安装程序提供了一些快捷键。您可以忽略此为现在和点击继续。

在Mac OS X怎么安装Docker

点击”关闭”结束安装

在Mac OS X怎么安装Docker

第三步, 验证安装

为了运行一个docker容器, 你需要:

  • 创建一个新的(或者开始一个已经存在的)docker engine 主机

  • 从你的环境切换到新的vm环境

  • 使用docker客户端创建, 加载, 管理容器

一旦你创建了docker machine, 你可以想任何一个virtual box vm一样随时使用它, 它会保持你使用后的相关配置.

1、打开launchpad, 找到docker quickstart terminal图标

在Mac OS X怎么安装Docker

2、点击docker quickstart terminal图标, 打开一个窗口.

终端会做一系列的事情来为你设置docker quickstart terminal

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、在终端窗口上点击鼠标用来激活

如果你不熟悉终端窗口,这里有一些快速提示。

在Mac OS X怎么安装Docker

该提示是传统的$美元符号。你输入命令在命令行这是提示后的区域。您的光标被突出显示的区域或指示|出现在命令行。键入命令后,一直按回车键。

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运行的hello-world没有工作,出现了错误,请查看故障排除快速修复常见问题。

以上就是关于“在Mac OS X怎么安装Docker”这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI