Docker 要求 Ubuntu 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的 Ubuntu 版本是否支持 Docker。

通过 uname -r 命令查看你当前的内核版本

 uname -r

4.15.0-20-generic

版本是4.15所以就没问题

然后使用脚本安装Docker

1.获取最新版本的Docker安装包

wget -qO- https://get.docker.com/ | 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 limingxing(我的用户名) Remember that you will have to log out and back in for this to take effect!

当要以非root用户可以直接运行docker时,需要执行 sudo usermod -aG docker runoob 命令(每次都是)

2.启动docker后台服务

 sudo service docker start

3.测试运行hello world

 sudo docker run hello-world

运行结果为(可以好好读一下setps):

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9bb5a5d4561a: Pull complete
Digest: sha256:3e1764d0f546ceac4565547df2ac4907fe46f007ea229fd7ef2718514bcec35d
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:
. The Docker client contacted the Docker daemon.
. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
. 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/engine/userguide/

鉴于国内网络问题,后续拉取 Docker 镜像十分缓慢,我们可以需要配置加速器来解决,我使用的是网易的镜像地址:http://hub-mirror.c.163.com。

新版的 Docker 使用 /etc/docker/daemon.json(Linux)来配置 Daemon。

请在该配置文件中加入(没有该文件的话,请先建一个):

{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}
 

4.15.0-20-generic

04-25 19:18