Docker 下载地址:https://desktop.docker.com/mac/stable/Docker.dmg
一、首先安装docker
1、安装完成后 查看版本信息
docker --version
Docker version 19.03.1, build 74b1e89
2、设置国内加速站点 以提升下载速度


https://registry.docker-cn.com
$ docker info.
..
Registry Mirrors: http://hub-mirror.c.163.com
Live Restore Enabled: false
二、使用命令
1、下载镜像
可以使用pull命令下载也可以直接去国内镜像仓库下载
网易云: https://c.163yun.com/hub#/m/home/
阿里云: https://promotion.aliyun.com/ntms/act/kubernetes.html
DaoCloud: https://www.daocloud.io/
pull mysql

2、启动容器
docker run mysql echo'first image'
docker run mysql

我们通过docker的两个参数 -i -t,让docker运行的容器实现"对话"的能力

-t:在新容器内指定一个伪终端或终端。
-i:允许你对容器内的标准输入 (STDIN) 进行交互。
此时我们已进入一个 ubuntu系统的容器
我们尝试在容器中运行命令 cat 、ls等命令查看当前系统的版本信息和当前目录下的文件列表

3、查看容器id
docker ps

4、停止容器
docker stop <container id>/<names>


更多请见:https://docs.docker.com/docker-for-mac/
三、资源汇总
1、Docker官网:https://www.docker.com/
2、Docker中文网站:https://www.docker-cn.com/
网友评论