Merge pull request #243 from yeasy/dev

Update install AND FAQ
pull/253/head
康怀帅 2017-11-24 10:17:47 +08:00 committed by GitHub
commit 3dabcb0fa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 324 additions and 58 deletions

View File

@ -14,6 +14,7 @@
* [Ubuntu](install/ubuntu.md)
* [Debian](install/debian.md)
* [CentOS](install/centos.md)
* [Raspberry Pi](install/raspberry-pi.md)
* [macOS](install/mac.md)
* [Windows PC](install/windows.md)
* [镜像加速器](install/mirror.md)

View File

@ -1,70 +1,105 @@
# 常见问题总结
## 镜像相关
### 如何批量清理临时镜像文件
答:可以使用 `docker rmi $(docker images -q -f dangling=true)` 命令。
### 如何批量清理临时镜像文件?
答:可以使用 `docker image prune` 命令。
### 如何查看镜像支持的环境变量?
答:可以使用 `docker run IMAGE env` 命令。
### 本地的镜像文件都存放在哪里?
答:与 Docker 相关的本地资源都存放在 `/var/lib/docker/` 目录下,以 aufs 文件系统为例,其中 container 目录存放容器信息graph 目录存放镜像信息aufs 目录下存放具体的镜像层文件。
答:与 Docker 相关的本地资源都存放在 `/var/lib/docker/` 目录下,以 `aufs` 文件系统为例,其中 `container` 目录存放容器信息,`graph` 目录存放镜像信息,`aufs` 目录下存放具体的镜像层文件。
### 构建 Docker 镜像应该遵循哪些原则?
答:整体原则上,尽量保持镜像功能的明确和内容的精简,要点包括
* 尽量选取满足需求但较小的基础系统镜像,例如大部分时候可以选择 debian:wheezy 或 debian:jessie 镜像,仅有不足百兆大小;
* 尽量选取满足需求但较小的基础系统镜像,例如大部分时候可以选择 debian:wheezy 或 debian:jessie 镜像,仅有不足百兆大小;
* 清理编译生成文件、安装包的缓存等临时文件;
* 安装各个软件时候要指定准确的版本号,并避免引入不需要的依赖;
* 从安全角度考虑,应用要尽量使用系统的库和依赖;
* 如果安装应用时候需要配置一些特殊的环境变量,在安装后要还原不需要保持的变量值;
* 使用 Dockerfile 创建镜像时候要添加 .dockerignore 文件或使用干净的工作目录。
更多内容请查看 [Dockerfile 最佳实践](https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/)
### 碰到网络问题,无法 pull 镜像,命令行指定 http_proxy 无效?
答:在 Docker 配置文件中添加 `export http_proxy="http://<PROXY_HOST>:<PROXY_PORT>"`,之后重启 Docker 服务即可。
## 容器相关
### 容器退出后,通过 docker ps 命令查看不到,数据会丢失么?
容器退出后会处于终止exited状态此时可以通过 `docker ps -a` 查看。其中的数据也不会丢失,还可以通过 `docker start` 命令来启动它。只有删除掉容器才会清除所有数据。
### 如何停止所有正在运行的容器
### 如何停止所有正在运行的容器?
答:可以使用 `docker kill $(docker ps -q)` 命令。
### 如何清理批量后台停止的容器?
答:可以使用 `docker rm -f $(docker ps -qa)` 命令。
### 如何批量清理已经停止的容器?
答:可以使用 `docker container prune` 命令。
### 如何获取某个容器的 PID 信息?
答:可以使用 `docker inspect --format '{{ .State.Pid }}' <CONTAINER ID or NAME>` 命令。
### 如何获取某个容器的 IP 地址?
答:可以使用 `docker inspect --format '{{ .NetworkSettings.IPAddress }}' <CONTAINER ID or NAME>` 命令
### 如何给容器指定一个固定 IP 地址,而不是每次重启容器 IP 地址都会变?
答:目前 Docker 并没有提供直接的对容器 IP 地址的管理支持,用户可以考虑参考第三部分中高级网络配置章节中介绍的创建点对点连接例子,来手动配置容器的静态 IP。或者在启动容器后再手动进行修改可参考其它类的问题 “*如何进入 Docker 容器的网络命名空间?*”)。
答:使用以下命令启动容器可以使容器 IP 固定不变
```bash
$ docker network create -d bridge --subnet 172.25.0.0/16 my-net
$ docker run --network=my-net --ip=172.25.3.3 -itd --name=my-container busybox
```
### 如何临时退出一个正在交互的容器的终端,而不终止它?
答:按 `Ctrl-p Ctrl-q`。如果按 `Ctrl-c` 往往会让容器内应用进程终止,进而会终止容器。
### 使用 `docker port` 命令映射容器的端口时系统报错“Error: No public port '80' published for xxx”
答:
* 创建镜像时 Dockerfile 要通过 EXPOSE 指定正确的开放端口;
* 创建镜像时 `Dockerfile` 要通过 `EXPOSE` 指定正确的开放端口;
* 容器启动时指定 `PublishAllPort = true`
### 可以在一个容器中同时运行多个应用进程么?
答:一般并不推荐在同一个容器内运行多个应用进程。如果有类似需求,可以通过一些额外的进程管理机制,比如 supervisord 来管理所运行的进程。可以参考 https://docs.docker.com/articles/using_supervisord/。
答:一般并不推荐在同一个容器内运行多个应用进程。如果有类似需求,可以通过一些额外的进程管理机制,比如 `supervisord` 来管理所运行的进程。可以参考 https://docs.docker.com/engine/admin/multi-service_container/ 。
### 如何控制容器占用系统资源CPU、内存的份额
答:在使用 `docker create` 命令创建容器或使用 `docker run` 创建并启动容器的时候,可以使用 -c|--cpu-shares[=0] 参数来调整容器使用 CPU 的权重;使用 -m|--memory[=MEMORY] 参数来调整容器使用内存的大小。
## 仓库相关
### 仓库Repository、注册服务器Registry、注册索引Index 有何关系?
首先,仓库是存放一组关联镜像的集合,比如同一个应用的不同版本的镜像。
注册服务器是存放实际的镜像文件的地方。注册索引则负责维护用户的账号、权限、搜索、标签等的管理。因此,注册服务器利用注册索引来实现认证等管理。
### 从非官方仓库(例如 non-official-repo.com下载镜像时候有时候会提示“Error: Invalid registry endpoint https://non-official-repo.com/v1/……”?
Docker 自 1.3.0 版本往后,加强了对镜像安全性的验证,需要添加私有仓库证书,或者手动添加对非官方仓库的信任。
编辑 Docker 配置文件,在其中添加:
```sh
@ -73,26 +108,14 @@ DOCKER_OPTS="--insecure-registry non-official-repo"
之后,重启 Docker 服务即可。
## 配置相关
### Docker 的配置文件放在哪里,如何修改配置?
答:使用 upstart 的系统如Ubuntu 14.04)的配置文件在 `/etc/default/docker`使用systemd 的系统(如 Ubuntu 16.04、Centos 等)的配置文件在 `/etc/systemd/system/docker.service.d/docker.conf`
Ubuntu 下面的配置文件内容如下,读者可以参考配。(如果出现该文件不存在的情况,重启或者自己新建一个文件都可以解决。)
答:使用 `upstart` 的系统(如 Ubuntu 14.04)的配置文件在 `/etc/default/docker`,使用 `systemd` 的系统(如 Ubuntu 16.04、Centos 等)的配置文件在 `/etc/docker/daemon.json`
```sh
# Customize location of Docker binary (especially for development testing).
#DOCKERD="/usr/local/bin/dockerd"
# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"
# This is also a handy place to tweak where Docker's temporary files go.
#export TMPDIR="/mnt/bigdrive/docker-tmp"
```
### 如何更改 Docker 的默认存储位置?
Docker 的默认存储位置是 `/var/lib/docker`,如果希望将 Docker 的本地文件存储到其他分区,可以使用 Linux 软连接的方式来完成,或者在启动 daemon 时通过 `-g` 参数指定。
例如,如下操作将默认存储位置迁移到 /storage/docker。
@ -115,15 +138,19 @@ lrwxrwxrwx. 1 root root 15 11月 17 13:43 docker -> /storage/docker
```
### 使用内存和 swap 限制启动容器时候报警告“WARNING: Your kernel does not support cgroup swap limit. WARNING: Your kernel does not support swap limit capabilities. Limitation discarded.”?
答:这是因为系统默认没有开启对内存和 swap 使用的统计功能,引入该功能会带来性能的下降。要开启该功能,可以采取如下操作:
* 编辑 `/etc/default/grub` 文件Ubuntu 系统为例),配置 `GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"`
* 更新 grub`$ sudo update-grub`
* 编辑 `/etc/default/grub` 文件Ubuntu 系统为例),配置 `GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"`
* 更新 grub`$ sudo update-grub`
* 重启系统,即可。
## Docker 与虚拟化
### Docker 与 LXCLinux Container有何不同
LXC 利用 Linux 上相关技术实现了容器。Docker 则在如下的几个方面进行了改进:
* 移植性:通过抽象容器配置,容器可以实现从一个平台移植到另一个平台;
* 镜像系统:基于 AUFS 的镜像系统为容器的分发带来了很多的便利,同时共同的镜像层只需要存储一份,实现高效率的存储;
@ -132,6 +159,7 @@ lrwxrwxrwx. 1 root root 15 11月 17 13:43 docker -> /storage/docker
* 周边工具:各种现有工具(配置管理、云平台)对 Docker 的支持,以及基于 Docker的 PaaS、CI 等系统,让 Docker 的应用更加方便和多样化。
### Docker 与 Vagrant 有何不同?
答:两者的定位完全不同。
* Vagrant 类似 Boot2Docker一款运行 Docker 的最小内核是一套虚拟机的管理环境。Vagrant 可以在多种系统上和虚拟机软件中运行,可以在 WindowsMac 等非 Linux 平台上为 Docker 提供支持,自身具有较好的包装性和移植性。
@ -141,52 +169,57 @@ lrwxrwxrwx. 1 root root 15 11月 17 13:43 docker -> /storage/docker
简单说Vagrant 适合用来管理虚拟机,而 Docker 适合用来管理应用环境。
### 开发环境中 Docker 和 Vagrant 该如何选择?
答:
Docker 不是虚拟机,而是进程隔离,对于资源的消耗很少,但是目前需要 Linux 环境支持。Vagrant 是虚拟机上做的封装,虚拟机本身会消耗资源。
答:Docker 不是虚拟机,而是进程隔离,对于资源的消耗很少,但是目前需要 Linux 环境支持。Vagrant 是虚拟机上做的封装,虚拟机本身会消耗资源。
如果本地使用的 Linux 环境,推荐都使用 Docker。
如果本地使用的是 OSX 或者 Windows 环境,那就需要开虚拟机,单一开发环境下 Vagrant 更简单;多环境开发下推荐在 Vagrant 里面再使用 Docker 进行环境隔离。
如果本地使用的是 macOS 或者 Windows 环境,那就需要开虚拟机,单一开发环境下 Vagrant 更简单;多环境开发下推荐在 Vagrant 里面再使用 Docker 进行环境隔离。
## 其它
### Docker 能在非 Linux 平台(比如 Windows 或 MacOS上运行么
答:可以。目前需要使用 docker for mac、boot2docker 等软件创建一个轻量级的 Linux 虚拟机层。
### Docker 能在非 Linux 平台(比如 Windows 或 macOS )上运行么?
答:完全可以。安装方法请查看 [安装 Docker](../../install/) 一节
### 如何将一台宿主主机的 Docker 环境迁移到另外一台宿主主机?
### 如何将一台宿主主机的 docker 环境迁移到另外一台宿主主机
答:停止 Docker 服务。将整个 Docker 存储文件夹复制到另外一台宿主主机,然后调整另外一台宿主主机的配置即可。
### 如何进入 Docker 容器的网络命名空间?
Docker 在创建容器后,删除了宿主主机上 `/var/run/netns` 目录中的相关的网络命名空间文件。因此,在宿主主机上是无法看到或访问容器的网络命名空间的。
用户可以通过如下方法来手动恢复它。
首先使用下面的命令查看容器进程信息比如这里的1234。
首先,使用下面的命令查看容器进程信息,比如这里的 1234。
```sh
```bash
$ docker inspect --format='{{. State.Pid}} ' $container_id
1234
```
接下来,在 /proc 目录下,把对应的网络命名空间文件链接到 /var/run/netns 目录。
```sh
接下来,在 `/proc` 目录下,把对应的网络命名空间文件链接到 `/var/run/netns` 目录。
```bash
$ sudo ln -s /proc/1234/ns/net /var/run/netns/
```
然后,在宿主主机上就可以看到容器的网络命名空间信息。例如
```sh
```bash
$ sudo ip netns show
1234
```
此时,用户可以通过正常的系统命令来查看或操作容器的命名空间了。例如修改容器的 IP 地址信息为 `172.17.0.100/16`
```sh
```bash
$ sudo ip netns exec 1234 ifconfig eth0 172.17.0.100/16
```
### 如何获取容器绑定到本地那个 veth 接口上?
Docker 容器启动后,会通过 veth 接口对连接到本地网桥veth 接口命名跟容器命名毫无关系,十分难以找到对应关系。
最简单的一种方式是通过查看接口的索引号,在容器中执行 `ip a` 命令,查看到本地接口最前面的接口索引号,如 `205`,将此值加上 1`206`,然后在本地主机执行 `ip a` 命令,查找接口索引号为 `206` 的接口,两者即为连接的 veth 接口对。

View File

@ -102,6 +102,41 @@ $ sudo groupadd docker
$ sudo usermod -aG docker $USER
```
### 测试 Docker 是否安装正确
```bash
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
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://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
```
若能正常输出以上信息,则说明安装成功。
### 镜像加速
鉴于国内网络问题,后续拉取 Docker 镜像十分缓慢,强烈建议安装 Docker 之后配置 [国内镜像加速](mirror.md)。
@ -133,4 +168,3 @@ $ sudo sysctl -p
### 参考文档
* [Docker 官方 CentOS 安装文档](https://docs.docker.com/engine/installation/linux/docker-ce/centos/)。
* [阿里云 Docker CE 安装镜像帮助](https://yq.aliyun.com/articles/110806)

View File

@ -10,9 +10,6 @@ Docker CE 支持以下版本的 [Debian](https://www.debian.org/intro/about) 操
* Jessie 8 (LTS)
* Wheezy 7.7 (LTS)
Docker CE 可以安装在 64 位的 x86 平台或 ARM 平台上(如[树莓派](https://www.raspberrypi.org/))。
#### 卸载旧版本
旧版本的 Docker 称为 `docker` 或者 `docker-engine`,使用以下命令卸载旧版本:
@ -120,19 +117,6 @@ $ sudo sh get-docker.sh --mirror Aliyun
执行这个命令后,脚本就会自动的将一切准备工作做好,并且把 Docker CE 的 edge 版本安装在系统中。
### 树莓派安装 Docker CE
基本和上述步骤相同,添加 apt 源时请使用如下命令:
```bash
$ sudo add-apt-repository \
"deb [arch=armhf] https://mirrors.ustc.edu.cn/docker-ce/linux/raspbian \
$(lsb_release -cs) \
stable"
```
ARM 平台不能使用 x86 镜像,查看树莓派可使用镜像请访问 [arm32v7](https://hub.docker.com/u/arm32v7/)。
### 启动 Docker CE
```bash
@ -162,6 +146,41 @@ $ sudo groupadd docker
$ sudo usermod -aG docker $USER
```
### 测试 Docker 是否安装正确
```bash
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
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://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
```
若能正常输出以上信息,则说明安装成功。
### 镜像加速
鉴于国内网络问题,后续拉取 Docker 镜像十分缓慢,强烈建议安装 Docker 之后配置 [国内镜像加速](mirror.md)。
@ -169,4 +188,3 @@ $ sudo usermod -aG docker $USER
### 参考文档
* [Docker 官方 Debian 安装文档](https://docs.docker.com/engine/installation/linux/docker-ce/debian/)
* [阿里云 Docker CE 安装镜像帮助](https://yq.aliyun.com/articles/110806)

146
install/raspberry-pi.md Normal file
View File

@ -0,0 +1,146 @@
## 树莓派卡片电脑安装 Docker CE
### 系统要求
Docker CE 不仅支持 `x86_64` 架构的计算机,同时也支持 `ARM` 架构的计算机,本小节内容以树莓派单片电脑为例讲解 `ARM` 架构安装 Docker CE。
Docker CE 支持以下版本的 [Raspbian](https://www.raspberrypi.org/downloads/raspbian/) 操作系统:
* Raspbian Stretch
* Raspbian Jessie
*注:* `Raspbian` 是树莓派基金会为树莓派卡片电脑设计的 Linux 发行版,其基于 Debian。
### 使用 APT 镜像源 安装
由于官方源使用 HTTPS 以确保软件下载过程中不被篡改。因此,我们首先需要添加使用 HTTPS 传输的软件包以及 CA 证书。
```bash
$ sudo apt-get update
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
lsb-release \
software-properties-common
```
鉴于国内网络问题,强烈建议使用国内源,下面先介绍国内源的使用。
#### 国内源
为了确认所下载软件包的合法性,需要添加软件源的 GPG 密钥。
```bash
$ curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/raspbian/gpg | sudo apt-key add -
```
然后,我们需要向 `source.list` 中添加 Docker CE 软件源:
```bash
$ sudo add-apt-repository \
"deb [arch=armhf] https://mirrors.ustc.edu.cn/docker-ce/linux/raspbian \
$(lsb_release -cs) \
stable"
```
>以上命令会添加稳定版本的 Docker CE APT 镜像源,如果需要最新版本的 Docker CE 请将 stable 改为 edge 或者 test。从 Docker 17.06 开始edge test 版本的 APT 镜像源也会包含稳定版本的 Docker CE。
#### 官方源
```bash
$ curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo apt-key add -
$ sudo add-apt-repository \
"deb [arch=armhf] https://download.docker.com/linux/raspbian \
$(lsb_release -cs) \
stable"
```
#### 安装 Docker CE
更新 apt 软件包缓存,并安装 `docker-ce`
```bash
$ sudo apt-get update
$ sudo apt-get install docker-ce
```
### 使用脚本自动安装
在测试或开发环境中 Docker 官方为了简化安装流程提供了一套便捷的安装脚本Raspbian 系统上可以使用这套脚本安装:
```bash
$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh --mirror Aliyun
```
执行这个命令后,脚本就会自动的将一切准备工作做好,并且把 Docker CE 的 edge 版本安装在系统中。
### 启动 Docker CE
```bash
$ sudo systemctl enable docker
$ sudo systemctl start docker
```
### 建立 docker 用户组
默认情况下,`docker` 命令会使用 [Unix socket](https://en.wikipedia.org/wiki/Unix_domain_socket) 与 Docker 引擎通讯。而只有 `root` 用户和 `docker` 组的用户才可以访问 Docker 引擎的 Unix socket。出于安全考虑一般 Linux 系统上不会直接使用 `root` 用户。因此,更好地做法是将需要使用 `docker` 的用户加入 `docker` 用户组。
建立 `docker` 组:
```bash
$ sudo groupadd docker
```
将当前用户加入 `docker` 组:
```bash
$ sudo usermod -aG docker $USER
```
### 测试 Docker 是否安装正确
```bash
$ docker run arm32v7/hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
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://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
```
若能正常输出以上信息,则说明安装成功。
*注意:* ARM 平台不能使用 `x86` 镜像,查看 Raspbian 可使用镜像请访问 [arm32v7](https://hub.docker.com/u/arm32v7/)。
### 镜像加速
鉴于国内网络问题,后续拉取 Docker 镜像十分缓慢,强烈建议安装 Docker 之后配置 [国内镜像加速](mirror.md)。

View File

@ -134,6 +134,41 @@ $ sudo groupadd docker
$ sudo usermod -aG docker $USER
```
### 测试 Docker 是否安装正确
```bash
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
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://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
```
若能正常输出以上信息,则说明安装成功。
### 镜像加速
鉴于国内网络问题,后续拉取 Docker 镜像十分缓慢,强烈建议安装 Docker 之后配置 [国内镜像加速](mirror.md)。
@ -141,4 +176,3 @@ $ sudo usermod -aG docker $USER
### 参考文档
* [Docker 官方 Ubuntu 安装文档](https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/)
* [阿里云 Docker CE 安装镜像帮助](https://yq.aliyun.com/articles/110806)