前言:為了使用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的狀態: