Macos中安装Docker
Macos中安装Docker详解b站学习地址:https://www.bilibili.com/video/BV1LQ4y127qT?p=1 Linux Docker、Swarm、 Kubernetes分布式微服务部署云原生实战全套资料下载地址:https://www.itying.com/goods-1155.html
Macos中安装Docker步骤如下:
1、下载安装 https://docs.docker.com/docker-for-mac/install/
如同 macOS 其它软件一样,安装也非常简单,双击下载的 .dmg 文件,然后将鲸鱼图标拖拽到 Application 文件夹即可。
从应用中找到 Docker 图标并点击运行。可能会询问 macOS 的登陆密码,输入即可。
点击顶部状态栏中的鲸鱼图标会弹出操作菜单。
第一次点击图标,可能会看到这个安装成功的界面,点击 “Got it!” 可以关闭这个窗口。
启动终端后,通过命令可以检查安装后的 Docker 版本。
$ docker --version
Docker version 17.09.1-ce, build 19e2cf6
2、镜像加速
鉴于国内网络问题,后续拉取 Docker 镜像十分缓慢,我们可以需要配置加速器来解决,我使用的是阿里云的镜像地址:https://02xz0m84.mirror.aliyuncs.com 在任务栏点击 Docker for mac 应用图标 -> Perferences… -> Docker Engine
{
...
"registry-mirrors": ["https://02xz0m84.mirror.aliyuncs.com"]
...
}
之后我们可以通过 docker info 来查看是否配置成功。
$ docker info
...
Registry Mirrors:
http://hub-mirror.c.163.com
Live Restore Enabled: false
3、通过运行hello world映像来验证Docker引擎安装是否正确
启动hello-world容器
docker run hello-world
[root@localhost /]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:df5f5184104426b65967e016ff2ac0bfcd44ad7899ca3bbcf8e44e4461491a9e
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 client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
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 ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/