前言:为了使用mininet和ovs,想要弄一个轻量级的linux环境,所以在mac上安装了docker,顺便体验一下docker的便捷。
1.安装环境要求
System Requirements: Docker for Mac will launch only if all of these requirements are met.
Mac hardware must be a 2010 or newer model, with Intel’s hardware support for memory management unit (MMU) virtualization; i.e., Extended Page Tables (EPT) and Unrestricted Mode. You can check to see if your machine has this support by running the following command in a terminal: sysctl kern.hv_support
macOS El Capitan 10.11 and newer macOS releases are supported. At a minimum, Docker for Mac requires macOS Yosemite 10.10.3 or newer, with the caveat that going forward 10.10.x is a use-at-your-own risk proposition.
Starting with Docker for Mac Stable release 1.13, and concurrent Edge releases, we will no longer address issues specific to macOS Yosemite 10.10. In future releases, Docker for Mac could stop working on macOS Yosemite 10.10 due to the deprecated status of this macOS version. We recommend upgrading to the latest version of macOS.
At least 4GB of RAM
VirtualBox prior to version 4.3.30 must NOT be installed (it is incompatible with Docker for Mac). If you have a newer version of VirtualBox installed, it’s fine.
Note: If your system does not satisfy these requirements, you can install Docker Toolbox, which uses Oracle VirtualBox instead of HyperKit.
2.下载安装包
https://docs.docker.com/docker-for-mac/install/;可以使用稳定版本,或者尝鲜的使用最新的版本。
3.安装docker
一路next,直到最后看到docker已经运行的标示。可以查看安装的版本信息等。
4.下载镜像,运行容器
4.1 因为在使用docker下载镜像时,默认是从docker官网的商店下载,十分缓慢,因此建议使用下载加速,我这里使用的是daocloud
的加速器,效果不错。
在daocloud的官网http://www.daocloud.io/mirror#可以注册账号,免费获得一个加速地址,然后设置docker的registry mirror就好了。
把申请出来的加速地址,加入到registry mirror中。然后点击apply & restart
重启docker.linux和windows平台的加速设置也可以参考daocloud的配置指导。http://www.daocloud.io/mirror#accelerator-doc
4.2 下载镜像
为了弄一个linux环境,下载了ubuntu 14.04的镜像。
使用docker pull ubuntu:14.04
来下载镜像:
- pull 是下载镜像的命令;
- ubuntu是下载的镜像名字,冒号后的14.04是版本号。
- 如果直接使用ubuntu不加版本号,默认是最新版。
4.3 运行容器
- 可以直接运行命令:
docker run -it ubuntu:14.04 bash
,会自动创建一个容器,运行后面的命令---bash.
查看当前运行的docker的状态: