跳到主要内容

三、Ubuntu 安装 Docker

Docker 最初的版本就是运行在 Ubuntu 上,所以,Ubuntu 上安装 Docker 应该是最简单的了

系统要求

Docker CE 对 Ubuntu 的系统还是有一定的要求的

1、 首先必须是64位版本的,这个应该问题不大,只要不是老古董,早就是64位的了;
2、 Ubuntu的版本必须是下表,或者比下表更新的版本;

    Artful 17.10 (Docker CE 17.11 Edge and higher only)
Xenial 16.04 (LTS)
Trusty 14.04 (LTS)

3、 Docker要求Ubuntu系统的内核版本高于3.10;

我们可以使用 uname -r 命令来查看当前的内核版本
    [root@pottercoding.cn ~] uname -r 
4.2.0-16-generic

安装 Docker

Ubuntu 安装 Docker 的方式有很多中,我们选择最省事的那种,最快速的那种

目前最快速的安装 Docker 的方式是使用官方给出的脚本 https://get.docker.com/

只需要在终端里输入以下命令即可开始安装

[root@pottercoding.cn ~]# curl -fsSL get.docker.com -o get-docker.sh
[root@pottercoding.cn ~]# sudo sh get-docker.sh
...
...
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 to log out and back in for this to take effect!
WARNING: Adding a user to the "docker" group grants the ability to run
containers which can be used to obtain root privileges on the
docker host.
Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
for more information.