MacOS上安装Docker

Docker引擎是基于Linux内核特性的开源应用容器。让开发者能够打包他们的应用以及依赖包到一个可移植的容器中,发布到任何流行的Linux容器上,实现虚拟化,容器运行在相似与iphone的沙盒中。
在MacOs上面运行Docker先安装Docker Toolbox面试

Docker Toolbox

Docker Toolbox是获取以及运行Docker生产环境最快捷的方式,他包括:docker

1.Docker Machine 
2.Docker
3.docker-compose
4.Docker GUI 
5.Docker command-line
6.VirtualBox

由于Docker是以及Linux内核的,因此不能直接在OS X上面运行,所以咱们须要VirtualBox,由于一个虚拟的Docker环境。
环境要求:OS X 10.8以上的,才能安装运行Docker Toolboxshell

安装

下载地址:https://www.docker.com/products/docker-toolbox
下载以后双击安装文件开始安装。ubuntu

安装界面:
图片描述
点击Continue能够看到要安装的工具:
图片描述bash

默认状况下Docker Toolbox会安装在/usr/local/bin目录下面。咱们须要让全部的用户都有访问Docker Toolbox安装文件的权限。
会出现让咱们输入密码的界面:
图片描述app

最后会安装两个快速启动的工具:
图片描述iphone

hello world

双击Application的Docker Quickstart Terminal:
图片描述
选择一个经常使用的终端,我选择的是iTerm。
等待初始化完成以后出现下面的界面ide

##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/


docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com

Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish

Docker的初始化运行已经完成了,下面试试经典的hello world工具

运行命令:ui

docker run hello-world

获得一个错误信息:

docker: Error response from daemon: client is newer than server (client API version: 1.22, server API version: 1.21).
See 'docker run --help'.

明显的 docker server的版本太低,升级下 docker server

docker-machine upgrade

再次运行:

docker run hello-world

获得结果:

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/

安装Docker完成。

相关文章
相关标签/搜索