Ubuntu 安装docker

1: 卸载旧版本

如果你曾经安装过旧版本的 Docker,首先需要卸载它们:

bash 复制代码
sudo apt-get remove docker docker-engine docker.io containerd runc

2: 安装依赖工具

安装一些必要的工具,以便后续的安装过程能够顺利进行:

bash 复制代码
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

3: 添加 Docker 官方 GPG 密钥

bash 复制代码
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

4: 设置稳定的 Docker 存储库

bash 复制代码
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

5: 安装 Docker Engine

bash 复制代码
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

6: 验证 Docker 安装

bash 复制代码
sudo docker --version

7: 将用户添加到 Docker 用户组(可选)

为了让你的用户不需要使用 sudo 权限就能够运行 Docker 命令,你可以将其添加到 Docker 用户组中:

bash 复制代码
sudo usermod -aG docker your_username

8: 重启并测试 Docker

bash 复制代码
sudo systemctl restart docker
docker run hello-world
相关推荐
栗子~~10 分钟前
Milvus docker-compose 部署
docker·容器·milvus
学习编程的gas12 分钟前
Linux开发工具——gcc/g++
linux·运维·服务器
嵌入式成长家17 分钟前
ubuntu rules 使用规则
linux·ubuntu·rules 使用规则
_可乐无糖24 分钟前
AWS WebRTC: 判断viewer端拉流是否稳定的算法
linux·服务器·webrtc·aws
数据智能老司机38 分钟前
Linux内核编程——Linux设备模型
linux·架构·操作系统
椰汁菠萝1 小时前
ubuntu下免sudo执行docker
ubuntu·docker·免sudo
BD_Marathon1 小时前
ubuntu防火墙使用
linux·ubuntu
dessler1 小时前
Kafka-消费者(Consumer)和消费者组(Consumer Group)
linux·运维·kafka
kfepiza1 小时前
Debian-10-standard用`networking`服务的`/etc/network/interfaces`配置文件设置多网卡多IPv6
linux·debian
进击的程序汪1 小时前
Linux 启动过程流程图--ARM版
linux·运维·arm开发