Ubuntu Focal 20.04 (LTS) 安装 Docker

官方安装文档: https://docs.docker.com/engine/install/ubuntu/

系统要求:

ubuntu必须是以下几个系统之一,64位。
Ubuntu Noble 24.04 (LTS)
Ubuntu Jammy 22.04 (LTS)
Ubuntu Focal 20.04 (LTS)

查看系统内核
$uname -a

安装步骤:

1.更新ubuntu

$sudo apt-get update

2.添加Docker库

2.1 安装需要的软件
$sudo apt-get install -y ca-certificates curl gnupg lsb-release

2.2 下载并添加Docker官方的GPG密钥
$curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

2.3 添加Docker稳定源
$echo
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

2.4 更新软件列表
$sudo apt-get update

3.安装Docker

3.1 安装社区版的命令行,服务器及容器运行时环境
$sudo apt-get install docker-ce docker-ce-cli containerd.io

3.2 启动Docker服务
$sudo systemctl start docker

3.3 验证Docke服务状态
$systemctl status docker

3.4 使Docker服务在每次重启时自动启动
$sudo systemctl enable docker

3.5 查看已安装的Docker版本
$sudo docker version

4.测试Docker
$sudo docker run hello-world

上述命令会下载一个Docker测试镜像,并在容器内执行一个 “hello_world” 样例程序。

posted @   useraka  阅读(123)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示