在 Ubuntu 16.04 上安装 Docker Engine(Install Docker Engine on Ubuntu 16.04)

安装环境:Ubuntu 16.04.6 LTS (Xenial Xerus)
安装版本:Docker version 19.03.8

部署人员:成长的小猪 Jason Song

目前Docker Engine非常的火哦,不管我们是运维还是开发,应该都要多多少少了解这么好的东西,首先就是要把它安装起来哦

安装方法

为了简化安装和升级任务,这里我推荐大家使用存储库安装,以下我会在Ubuntu 16.04.6 LTS (Xenial Xerus)系统上进行全新安装;首次在安装Docker Engine之前,需要设置Docker存储库,之后你可以从存储库进行安装和更新Docker。

设置存储库

  1、更新apt软件包索引

root@jasonsoft:~# sudo apt-get update

  2、安装软件包以允许apt通过HTTPS使用存储库

root@jasonsoft:~# sudo apt-get install -y \
     apt-transport-https \
     ca-certificates \
     curl \
     gnupg-agent \
     software-properties-common

 3、添加Docker的官方GPG密钥

root@jasonsoft:~# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

      验证您现在是否拥有带有指纹的密钥

root@jasonsoft:~# sudo apt-key fingerprint 0EBFCD88
pub   4096R/0EBFCD88 2017-02-22
      Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid                  Docker Release (CE deb) 
sub   4096R/F273FCD8 2017-02-22

  4、通过以下命令来设置稳定版本的存储库

root@jasonsoft:~# sudo add-apt-repository \
    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) \
    stable"

现在我们就开安装 DOCKER 引擎

     1、首先我们来更新apt程序包索引,并安装最新版本的Docker Engine和容器

root@jasonsoft:~# sudo apt-get update

root@jasonsoft:~# sudo apt-get install -y docker-ce docker-ce-cli containerd.io

         通过上面的命令安装结束后,我们来确认一下是否已安装成功,通过以下命令确认一下服务是否已启动,看到Active: active (running)状态表示服务已成功启动

root@jasonsoft:~# sudo systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-05-12 12:27:09 CST; 7min ago
     Docs: https://docs.docker.com
 Main PID: 20658 (dockerd)
   CGroup: /system.slice/docker.service
           └─20658 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

May 12 12:27:08 jasonsoft dockerd[20658]: time="2020-05-12T12:27:08.899977265+08:00" level=warning msg="Your kernel does not support swap memory limit"
May 12 12:27:08 jasonsoft dockerd[20658]: time="2020-05-12T12:27:08.900013583+08:00" level=warning msg="Your kernel does not support cgroup rt period"
May 12 12:27:08 jasonsoft dockerd[20658]: time="2020-05-12T12:27:08.900020683+08:00" level=warning msg="Your kernel does not support cgroup rt runtime"
May 12 12:27:08 jasonsoft dockerd[20658]: time="2020-05-12T12:27:08.900211202+08:00" level=info msg="Loading containers: start."
May 12 12:27:09 jasonsoft dockerd[20658]: time="2020-05-12T12:27:09.355505580+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Da
May 12 12:27:09 jasonsoft dockerd[20658]: time="2020-05-12T12:27:09.416607313+08:00" level=info msg="Loading containers: done."
May 12 12:27:09 jasonsoft dockerd[20658]: time="2020-05-12T12:27:09.449430625+08:00" level=info msg="Docker daemon" commit=afacb8b7f0 graphdriver(s)=overlay2 version=19.03.8
May 12 12:27:09 jasonsoft dockerd[20658]: time="2020-05-12T12:27:09.449558655+08:00" level=info msg="Daemon has completed initialization"
May 12 12:27:09 jasonsoft dockerd[20658]: time="2020-05-12T12:27:09.475339605+08:00" level=info msg="API listen on /var/run/docker.sock"
May 12 12:27:09 jasonsoft systemd[1]: Started Docker Application Container Engine.

       能过以下命令查看Docker Engine相关信息

root@jasonsoft:~# docker -v
Docker version 19.03.8, build afacb8b7f0

root@jasonsoft:~# docker info
Client:
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 19.03.8
 Storage Driver: overlay2
  Backing Filesystem: 
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs

  看到上面信息表示安装成功啦,后面我们就可以在Docker Engine上嗨起来了

查看我本人更多原创文章,请点击这里。

你可能感兴趣的:(系统部署,软件安装,Docker)