docker官方提供的参考https://docs.docker.com/install/linux/docker-ce/ubuntu/
官方的安装可能有点复杂,本章采用最简单的安装方式:安装Ubuntu维护的版本

1、检查Ubuntu的内核是否高于3.10,低于这个版本的内核不支持Docker

~$ uname -r
5.0.0-31-generic

2、移除旧的Docker,从来没有安装过,可以跳过

~$ sudo apt-get remove docker.io

3、安装Docker

~$ sudo apt-get install docker.io

4、运行Hello World检验是否成功

~$ sudo docker run hello-world

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://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

成功了!
5、查看Docker版本信息

~$ sudo docker version
Client:
 Version:           18.09.7
 API version:       1.39
 Go version:        go1.10.1
 Git commit:        2d0083d
 Built:             Fri Aug 16 14:20:06 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.09.7
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.1
  Git commit:       2d0083d
  Built:            Wed Aug 14 19:41:23 2019
  OS/Arch:          linux/amd64
  Experimental:     false

谢谢阅读!

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐