使用 Homebrew 安装
macOS 我们可以使用 Homebrew 来安装 Docker。
Homebrew 的 Cask 已经支持 Docker for Mac,因此可以很方便的使用 Homebrew Cask 来进行安装:
❯ brew install --cask --appdir=/Applications docker Running `brew update --preinstall`... ==> Auto-updated Homebrew! Updated 3 taps (homebrew/cask-versions, homebrew/core and homebrew/cask). ==> New Formulae bk brev kyverno ==> Updated Formulae Updated 36 formulae. ==> Updated Casks Updated 42 casks.
==> Downloading https://desktop.docker.com/mac/main/amd64/74594/Docker.dmg # ==> Installing Cask docker ==> Moving App 'Docker.app' to '/Applications/Docker.app' ==> Linking Binary 'docker-compose.bash-completion' to '/usr/local/etc/bash_completion.d/docker-compose' ==> Linking Binary 'docker.zsh-completion' to '/usr/local/share/zsh/site-functions/_docker' ==> Linking Binary 'docker.fish-completion' to '/usr/local/share/fish/vendor_completions.d/docker.fish' ==> Linking Binary 'docker-compose.fish-completion' to '/usr/local/share/fish/vendor_completions.d/docker-compose.fish' ==> Linking Binary 'docker-compose.zsh-completion' to '/usr/local/share/zsh/site-functions/_docker_compose' ==> Linking Binary 'docker.bash-completion' to '/usr/local/etc/bash_completion.d/docker' 🍺 docker was successfully installed!
|
安装完成后,Applications中查看Docker程序
启动终端后,通过命令可以检查安装后的 Docker 版本。
❯ docker --version Docker version 20.10.12, build e91ed57
|
镜像加速
CLI
docker run hello-world --registry-mirror=https://docker.mirrors.ustc.edu.cn
|
GUI
在任务栏点击 Docker for mac 应用图标 -> Perferences -> 右上角⚙️ -> Docker Engine , 在里面添加国内源,点击“Apple & Restart”
"registry-mirrors": [ "http://hub-mirror.c.163.com", "https://docker.mirrors.ustc.edu.cn", "https://registry.docker-cn.com" ],
|
国内镜像汇总
- 开放源
- 需注册