Skip to main content

linux docker engine

·93 words·1 min
😈long && 😻liang
Author
😈long && 😻liang
A IT worker with PHP/GO as the main technology stack
linux-server-setup - This article is part of a series.
Part 2: This Article

linux-docker
#


源地址

系统介绍
#

  • Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-76-generic x86_64)

安装
#


  • 添加docker的官方GPG密钥
apt-get update
apt-get install ca-certificates curl gnupg
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
chmod a+r /etc/apt/keyrings/docker.gpg
  • 添加存储库到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-get update
  • 安装最新版本docker包
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  • 验证安装
docker run hello-world
  • 结果
    hello world

卸载
#


  • 使用apk卸载
apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
  • 删除所有镜像、容器、卷和自定义配置
rm -rf /var/lib/containerd
rm -rf /var/lib/containerd
linux-server-setup - This article is part of a series.
Part 2: This Article