码迷,mamicode.com
首页 > 系统相关 > 详细

ubuntu 16 安装docker

时间:2020-02-27 13:11:25      阅读:113      评论:0      收藏:0      [点我收藏+]

标签:inf   glob   img   http   roo   apt   att   mat   rect   

参考:https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce

若已经安装过docker,先进行删除卸载
root@vonedao-sit02:/data# apt-get remove docker docker-engine docker.io containerd runc Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package docker E: Unable to locate package docker-engine E: Unable to locate package docker.io E: Couldn‘t find any package by glob ‘docker.io‘ E: Couldn‘t find any package by regex ‘docker.io‘ E: Unable to locate package containerd E: Unable to locate package runc
更新包信息 root@vonedao-sit02:/data# apt-get update Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial InRelease [247 kB] Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates InRelease [109 kB] Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security InRelease [109 kB] Get:4 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main Sources [868 kB] Get:5 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/universe Sources [7,728 kB] Get:6 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 Packages [1,201 kB] Get:7 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main i386 Packages [1,196 kB] Get:8 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main Translation-en [568 kB] Get:9 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/universe amd64 Packages [7,532 kB] Get:10 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/universe i386 Packages [7,512 kB] Get:11 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/universe Translation-en [4,354 kB] Get:12 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main Sources [346 kB] Get:13 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/universe Sources [265 kB] Get:14 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main amd64 Packages [1,110 kB] Get:15 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main i386 Packages [902 kB] Get:16 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main Translation-en [424 kB] Get:17 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/universe amd64 Packages [785 kB] Get:18 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/universe i386 Packages [712 kB] Get:19 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/universe Translation-en [329 kB] Get:20 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/main Sources [162 kB] Get:21 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/universe Sources [118 kB] Get:22 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/main amd64 Packages [831 kB] Get:23 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/main i386 Packages [643 kB] Get:24 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/main Translation-en [316 kB] Get:25 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/universe amd64 Packages [486 kB] Get:26 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/universe i386 Packages [420 kB] Get:27 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/universe Translation-en [199 kB] Fetched 39.5 MB in 5s (6,626 kB/s) Reading package lists... Done

确保APT能使用https方式工作,并且CA证书已安装了 root@vonedao-sit02:/data# apt-get install > apt-transport-https > ca-certificates > curl > gnupg-agent > software-properties-common Reading package lists... Done Building dependency tree Reading state information... Done apt-transport-https is already the newest version (1.2.32). ca-certificates is already the newest version (20170717~16.04.2). curl is already the newest version (7.47.0-1ubuntu2.14). The following additional packages will be installed: libassuan0 libnpth0 pinentry-curses python3-pycurl python3-software-properties unattended-upgrades Suggested packages: pinentry-doc libcurl4-gnutls-dev python-pycurl-doc python3-pycurl-dbg bsd-mailx needrestart The following NEW packages will be installed: gnupg-agent libassuan0 libnpth0 pinentry-curses python3-pycurl python3-software-properties software-properties-common unattended-upgrades 0 upgraded, 8 newly installed, 0 to remove and 42 not upgraded. Need to get 428 kB of archives. After this operation, 2,103 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 libassuan0 amd64 2.4.2-2 [34.6 kB] Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 pinentry-curses amd64 0.9.7-3 [31.2 kB] Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 libnpth0 amd64 1.2-3 [7,998 B] Get:4 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main amd64 gnupg-agent amd64 2.1.11-6ubuntu2.1 [240 kB] Get:5 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 python3-pycurl amd64 7.43.0-1ubuntu1 [42.3 kB] Get:6 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main amd64 python3-software-properties all 0.96.20.9 [20.1 kB] Get:7 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main amd64 software-properties-common all 0.96.20.9 [9,452 B] Get:8 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main amd64 unattended-upgrades all 1.1ubuntu1.18.04.7~16.04.5 [42.1 kB] Fetched 428 kB in 0s (1,670 kB/s) Preconfiguring packages ... Selecting previously unselected package libassuan0:amd64. (Reading database ... 100859 files and directories currently installed.) Preparing to unpack .../libassuan0_2.4.2-2_amd64.deb ... Unpacking libassuan0:amd64 (2.4.2-2) ... Selecting previously unselected package pinentry-curses. Preparing to unpack .../pinentry-curses_0.9.7-3_amd64.deb ... Unpacking pinentry-curses (0.9.7-3) ... Selecting previously unselected package libnpth0:amd64. Preparing to unpack .../libnpth0_1.2-3_amd64.deb ... Unpacking libnpth0:amd64 (1.2-3) ... Selecting previously unselected package gnupg-agent. Preparing to unpack .../gnupg-agent_2.1.11-6ubuntu2.1_amd64.deb ... Unpacking gnupg-agent (2.1.11-6ubuntu2.1) ... Selecting previously unselected package python3-pycurl. Preparing to unpack .../python3-pycurl_7.43.0-1ubuntu1_amd64.deb ... Unpacking python3-pycurl (7.43.0-1ubuntu1) ... Selecting previously unselected package python3-software-properties. Preparing to unpack .../python3-software-properties_0.96.20.9_all.deb ... Unpacking python3-software-properties (0.96.20.9) ... Selecting previously unselected package software-properties-common. Preparing to unpack .../software-properties-common_0.96.20.9_all.deb ... Unpacking software-properties-common (0.96.20.9) ... Selecting previously unselected package unattended-upgrades. Preparing to unpack .../unattended-upgrades_1.1ubuntu1.18.04.7~16.04.5_all.deb ... Unpacking unattended-upgrades (1.1ubuntu1.18.04.7~16.04.5) ... Processing triggers for libc-bin (2.23-0ubuntu11) ... Processing triggers for man-db (2.7.5-1) ... Processing triggers for dbus (1.10.6-1ubuntu3.5) ... Processing triggers for ureadahead (0.100.0-19.1) ... Processing triggers for systemd (229-4ubuntu21.23) ... Setting up libassuan0:amd64 (2.4.2-2) ... Setting up pinentry-curses (0.9.7-3) ... Setting up libnpth0:amd64 (1.2-3) ... Setting up gnupg-agent (2.1.11-6ubuntu2.1) ... Setting up python3-pycurl (7.43.0-1ubuntu1) ... Setting up python3-software-properties (0.96.20.9) ... Setting up software-properties-common (0.96.20.9) ... Setting up unattended-upgrades (1.1ubuntu1.18.04.7~16.04.5) ... Creating config file /etc/apt/apt.conf.d/50unattended-upgrades with new version Synchronizing state of unattended-upgrades.service with SysV init with /lib/systemd/systemd-sysv-install... Executing /lib/systemd/systemd-sysv-install enable unattended-upgrades Processing triggers for libc-bin (2.23-0ubuntu11) ... Processing triggers for dbus (1.10.6-1ubuntu3.5) ... Processing triggers for ureadahead (0.100.0-19.1) ... Processing triggers for systemd (229-4ubuntu21.23) ... root@vonedao-sit02:/data# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - OK

root@vonedao-sit02:/data# 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) <docker@docker.com>
sub 4096R/F273FCD8 2017-02-22

 

技术图片

 

 

 基于不同cpu,使用的命令也不同。

我们看下当前cpu是什么:

技术图片

 

 

 

root@vonedao-sit02:/data# add-apt-repository >    "deb [arch=amd64] https://download.docker.com/linux/ubuntu >    $(lsb_release -cs) >    stable"
root@vonedao-sit02:/data# apt-get update
Hit:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial InRelease
Hit:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates InRelease
Hit:3 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security InRelease
Get:4 https://download.docker.com/linux/ubuntu xenial InRelease [66.2 kB]
Get:5 https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages [12.3 kB]                                                                            
Fetched 78.5 kB in 10s (7,796 B/s)                                                                                                                               
Reading package lists... Done
root@vonedao-sit02:/data# apt-get install docker-ce docker-ce-cli containerd.io
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  aufs-tools cgroupfs-mount git git-man liberror-perl libltdl7 pigz
Suggested packages:
  mountall git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch git-cvs git-mediawiki git-svn
The following NEW packages will be installed:
  aufs-tools cgroupfs-mount containerd.io docker-ce docker-ce-cli git git-man liberror-perl libltdl7 pigz
0 upgraded, 10 newly installed, 0 to remove and 42 not upgraded.
Need to get 89.3 MB of archives.
After this operation, 410 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/universe amd64 pigz amd64 2.3.1-2 [61.1 kB]
Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/universe amd64 aufs-tools amd64 1:3.2+20130722-1.1ubuntu1 [92.9 kB]
Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/universe amd64 cgroupfs-mount all 1.2 [4,970 B]
Get:4 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 liberror-perl all 0.17-1.2 [19.6 kB]
Get:5 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main amd64 git-man all 1:2.7.4-0ubuntu1.7 [736 kB]
Get:6 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main amd64 git amd64 1:2.7.4-0ubuntu1.7 [3,160 kB]
Get:7 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 libltdl7 amd64 2.4.6-0.1 [38.3 kB]
Get:8 https://download.docker.com/linux/ubuntu xenial/stable amd64 containerd.io amd64 1.2.10-3 [19.9 MB]
Get:9 https://download.docker.com/linux/ubuntu xenial/stable amd64 docker-ce-cli amd64 5:19.03.6~3-0~ubuntu-xenial [42.5 MB]                                     
Get:10 https://download.docker.com/linux/ubuntu xenial/stable amd64 docker-ce amd64 5:19.03.6~3-0~ubuntu-xenial [22.8 MB]                                        
Fetched 89.3 MB in 2min 58s (501 kB/s)                                                                                                                           
Selecting previously unselected package pigz.
(Reading database ... 100965 files and directories currently installed.)
Preparing to unpack .../pigz_2.3.1-2_amd64.deb ...
Unpacking pigz (2.3.1-2) ...
Selecting previously unselected package aufs-tools.
Preparing to unpack .../aufs-tools_1%3a3.2+20130722-1.1ubuntu1_amd64.deb ...
Unpacking aufs-tools (1:3.2+20130722-1.1ubuntu1) ...
Selecting previously unselected package cgroupfs-mount.
Preparing to unpack .../cgroupfs-mount_1.2_all.deb ...
Unpacking cgroupfs-mount (1.2) ...
Selecting previously unselected package containerd.io.
Preparing to unpack .../containerd.io_1.2.10-3_amd64.deb ...
Unpacking containerd.io (1.2.10-3) ...
Selecting previously unselected package docker-ce-cli.
Preparing to unpack .../docker-ce-cli_5%3a19.03.6~3-0~ubuntu-xenial_amd64.deb ...
Unpacking docker-ce-cli (5:19.03.6~3-0~ubuntu-xenial) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../docker-ce_5%3a19.03.6~3-0~ubuntu-xenial_amd64.deb ...
Unpacking docker-ce (5:19.03.6~3-0~ubuntu-xenial) ...
Selecting previously unselected package liberror-perl.
Preparing to unpack .../liberror-perl_0.17-1.2_all.deb ...
Unpacking liberror-perl (0.17-1.2) ...
Selecting previously unselected package git-man.
Preparing to unpack .../git-man_1%3a2.7.4-0ubuntu1.7_all.deb ...
Unpacking git-man (1:2.7.4-0ubuntu1.7) ...
Selecting previously unselected package git.
Preparing to unpack .../git_1%3a2.7.4-0ubuntu1.7_amd64.deb ...
Unpacking git (1:2.7.4-0ubuntu1.7) ...
Selecting previously unselected package libltdl7:amd64.
Preparing to unpack .../libltdl7_2.4.6-0.1_amd64.deb ...
Unpacking libltdl7:amd64 (2.4.6-0.1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
Processing triggers for systemd (229-4ubuntu21.23) ...
Setting up pigz (2.3.1-2) ...
Setting up aufs-tools (1:3.2+20130722-1.1ubuntu1) ...
Setting up cgroupfs-mount (1.2) ...
Setting up containerd.io (1.2.10-3) ...
Setting up docker-ce-cli (5:19.03.6~3-0~ubuntu-xenial) ...
Setting up docker-ce (5:19.03.6~3-0~ubuntu-xenial) ...
Setting up liberror-perl (0.17-1.2) ...
Setting up git-man (1:2.7.4-0ubuntu1.7) ...
Setting up git (1:2.7.4-0ubuntu1.7) ...
Setting up libltdl7:amd64 (2.4.6-0.1) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
Processing triggers for systemd (229-4ubuntu21.23) ...
root@vonedao-sit02:/data# lsb_release -cs
xenial

  技术图片

 

 

 

root@vonedao-sit02:/data# apt-get install docker-ce=5:19.03.6~3-0~ubuntu-xenial docker-ce-cli=5:19.03.6~3-0~ubuntu-xenial containerd.io
Reading package lists... Done
Building dependency tree       
Reading state information... Done
containerd.io is already the newest version (1.2.10-3).
docker-ce-cli is already the newest version (5:19.03.6~3-0~ubuntu-xenial).
docker-ce is already the newest version (5:19.03.6~3-0~ubuntu-xenial).
0 upgraded, 0 newly installed, 0 to remove and 42 not upgraded.

    root@vonedao-sit02:/data# docker -v
    Docker version 19.03.6, build 369ce74a3c

  

ubuntu 16 安装docker

标签:inf   glob   img   http   roo   apt   att   mat   rect   

原文地址:https://www.cnblogs.com/zoujiaojiao/p/12371384.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!