1.在 Linux 机器上打开一个新的 Shell。
2. 使用wget
从 https://get.docker.com 获取并运行 Docker 安装脚本,然后采用 Shell 中管道(pipe
)的方式来执行这个脚本。
$ wget -qO- https://get.docker.com/ | sh
modprobe: FATAL: Module aufs not found /lib/modules/4.4.0-36-generic
+ sh -c 'sleep 3; yum -y -q install docker-engine'
<Snip>
If you would like to use Docker as a non-root user, you should
now consider adding your user to the "docker" group with
something like:
sudo usermod -aG docker your-user
Remember that you will have to log out and back in...
3. 最好通过非 root 用户来使用 Docker。这时需要添加非 root 用户到本地 Docker Unix 组当中。
$ sudo usermod -aG docker docker_01
$ cat /etc/group | grep docker
docker:x:999:docker_01
4.确认 Docker 已经在 Linux 上安装成功。
$ docker --version
Docker version 18.01.0-ce, build 03596f5
$ docker system info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.01.0-ce
Storage Driver: overlay2
Backing Filesystem: extfs
<Snip>
提示:如果上述步骤在自己的 Linux 发行版中无法成功执行,可以访问 Docker Docs 网站(https://docs.docker.com)并单击与自己的版本相关的那个链接。