Home Ubuntu 22.04 安装 Docker
Post
Cancel

Ubuntu 22.04 安装 Docker

1. 安装证书并允许 apt 通过 HTTPS 使用存储库

1
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg lsb-release

2. 添加 Docker 官方 GPG 密钥

1
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

3. 添加 Docker 官方库

1
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

4. 更新源列表并安装 Dockerdocker-compose

1
2
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose docker-compose-plugin

5. 查看 Docker 服务状态

1
sudo systemctl status docker.service

如果服务没有启动,启动 Docker 服务

1
sudo systemctl start docker.service
This post is licensed under CC BY 4.0 by the author.