使用apt安装docker

基于apt安装docker并配置添加当前用户到docker组以赋予权限.

Docker安装[apt]

所有操作在root权限下执行。

  1. Set up Docker’s apt repository.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Add Docker's official GPG key:
apt update
apt install ca-certificates curl gnupg 
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
 
# Add the repository to Apt sources:
echo \
   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
   $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
   tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update
  1. Install the Docker packages.
1
apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  1. Verify that the installation is successful by running the hello-world image:
1
docker run hello-world
  1. 添加当前用户到docker组以赋予权限:
1
usermod -aG docker ${USER} 
使用 Hugo 构建
主题 StackJimmy 设计