Debian11 安装 Docker
文章摘要
GPT 4
一、安装Docker
1.更新系统软件包
1 | sudo apt update |
2.安装所需的依赖库和工具:
1 | sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release |
3.添加Docker
官方GPT
秘钥:
1 | curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg |
4.设置Docker
稳定版存储库
1 | echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null |
5.更新软件包索引:(这一步可要可不要,因为前面已经执行了)
1 | sudo apt update |
6.安装Docker引擎:
1 | sudo apt install docker-ce docker-ce-cli containerd.io |
7.添加当前用户到Docker
组:
1 | sudo usermod -aG docker $USER |
安装成功以后提示:
1 | root@Debian:~# docker version #查看版本 |
二、安装Docker Compose
下载 Docker Compose
二进制文件:
1 | sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose |
添加执行权限:
1 | sudo chmod +x /usr/local/bin/docker-compose |
验证Docker Compose
是否安装成功:
1 | docker-compose version |
本文是原创文章,采用CC BY-NC-SA 4.0协议,完整转载请注明来自Couture
评论 ()