Linux下搭建 Docker Engine (Ubuntu系统)

官方链接

https://docs.docker.com/engine/install/ubuntu/

卸载之前安装的docker相关包

for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do \
    sudo apt-get remove $pkg; \
done

升级apt并安装需要的包

sudo apt-get update -yqq && sudo apt-get install -yqq ca-certificates curl gnupg

配置GPG 密钥

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

增加Docker相关apt源

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

更新apt

sudo apt-get update

安装Docker Engine

sudo apt-get install -yqq docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

查看安装的Docker版本

docker version

查看Docker是否启动

service docker status

启动Docker容器

sudo docker run hello-world


Linux下搭建 Docker Engine (Ubuntu系统)
https://lysowc.cn/archives/1719406423756
作者
sora
发布于
2024年06月26日
许可协议