ubuntu 安装 docker
ubuntu 22.04
1、更新升级apt
sudo apt update
sudo apt upgrade
2、安装必备的软件包以允许apt通过 HTTPS 使用存储库(repository)
sudo apt-get install ca-certificates curl gnupg lsb-release
3、添加Docker官方版本库的GPG密钥
先创建目录
sudo mkdir -p /etc/apt/keyrings
再添加密钥
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
4、设置存储库
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
5、安装docker
安装最新版本的Docker Engine、containerd 和 Docker Compose
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
6、验证docker是否安装成功
查看docker版本
docker version
7、查看docker运行状态
systemctl status docker
8、启动docker服务
sudo systemctl start docker
9、设置docker开机自动启动
sudo systemctl enable docker
ubuntu 安装 docker
https://www.lihaibao.cn/2023/11/22/ubuntu-安装-docker/