ubuntu 20.4安装docker

ubuntu 20.4 安装docker

目录

  • 查看版本并升级套件
  • 安装必要软件
  • 添加阿里云的GPG密钥,命令设置存储库
  • 执行安装,查看版本

查看版本并升级套件

cat /proc/version

Linux version 5.4.0-135-generic (buildd@lcy02-amd64-066) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)) #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC

apt-get update

Hit:1 http://mirrors.aliyun.com/ubuntu focal InRelease                        
Get:2 http://mirrors.aliyun.com/ubuntu focal-updates InRelease [114 kB]                       
Get:3 http://mirrors.aliyun.com/ubuntu focal-backports InRelease [108 kB]                     
Get:4 http://mirrors.aliyun.com/ubuntu focal-security InRelease [114 kB]                    
Get:5 http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid InRelease [3,956 B]                                                  
Get:6 http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid/main amd64 Packages [418 B] 

安装必要软件

apt-get install ca-certificates curl gnupg lsb-release

Reading package lists... Done
Building dependency tree       
Reading state information... Done
lsb-release is already the newest version (11.1.0ubuntu2).
lsb-release set to manually installed.
ca-certificates is already the newest version (20211016ubuntu0.20.04.1).
ca-certificates set to manually installed.
curl is already the newest version (7.68.0-1ubuntu2.14).
curl set to manually installed.
gnupg is already the newest version (2.2.19-3ubuntu2.2).
gnupg set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 34 not upgraded.

添加阿里云的GPG密钥,命令设置存储库

mkdir -p /etc/apt/keyrings curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

Hit:1 http://mirrors.aliyun.com/ubuntu focal InRelease                                                            
Hit:2 http://mirrors.aliyun.com/ubuntu focal-updates InRelease                                                    
Hit:3 http://mirrors.aliyun.com/ubuntu focal-backports InRelease                                                                                  
Hit:4 http://mirrors.aliyun.com/ubuntu focal-security InRelease                                                                                   
Hit:5 http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid InRelease                                                      
Get:6 http://mirrors.aliyun.com/docker-ce/linux/ubuntu focal InRelease [57.7 kB]                  
Get:7 http://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages [22.3 kB]
Get:8 https://download.docker.com/linux/ubuntu focal InRelease [57.7 kB]                                                                                
Get:9 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages [22.3 kB]                                                                    
Fetched 160 kB in 21s (7,518 B/s)                                                                                                                       
Reading package lists... Done

执行安装,查看版本

apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y
docker version

Client: Docker Engine - Community
 Version:           20.10.22
 API version:       1.41
 Go version:        go1.18.9
 Git commit:        3a2c30b
 Built:             Thu Dec 15 22:28:08 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.22
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.9
  Git commit:       42c8b31
  Built:            Thu Dec 15 22:25:58 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.14
  GitCommit:        9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
posted @ 2022-12-29 19:53  干炸小黄鱼  阅读(272)  评论(0)    收藏  举报