【基于阿里云上Ubantu系统部署配置docker】

1.安装依赖工具

powershell 复制代码
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common

2.添加 Docker 官方 GPG 密钥

powershell 复制代码
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

3.配置阿里云镜像源

powershell 复制代码
sudo add-apt-repository "deb [arch=amd64] http://mirrors.cloud.aliyuncs.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

4.更新源并安装 Docker

powershell 复制代码
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

5.启动服务并设置自启

powershell 复制代码
sudo systemctl start docker
sudo systemctl enable docker

6.验证安装

powershell 复制代码
docker --version  # 查看版本
sudo docker run hello-world  # 运行测试容器

7.权限优化(避免频繁 sudo)

powershell 复制代码
sudo usermod -aG docker $USER  # 当前用户加入 docker 组
newgrp docker  # 立即生效组权限

8.故障排查

powershell 复制代码
1)apt update 报错‌:
检查 /etc/apt/sources.list  是否配置阿里云Ubuntu源

2)更新秘钥失败:

powershell 复制代码
sudo gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7EA0A9C3F273FCD8
sudo gpg --export --armor 7EA0A9C3F273FCD8 | sudo tee /etc/apt/trusted.gpg.d/7EA0A9C3F273FCD8.asc

‌注意‌:以上流程适配 ‌Ubuntu 18.04/20.04/22.04‌,其他版本需调整源路径中的 $(lsb_release -cs) 系统代号

验证安装docker:查看版本号docker --version; 查看运行状态 sudo systemctl status docker

相关推荐
Patrick_Wilson5 天前
从「改个端口」到 502:Next.js on k8s 的容器端口、Service 映射与 env 覆盖
docker·kubernetes·next.js
Suroy5 天前
DockerView-Go:用 Go 写一个终端 Docker 监控工具,顺便做了个 Web 仪表盘
docker
云恒要逆袭5 天前
运行你的第一个Docker容器
后端·docker·容器
宋均浩6 天前
# Docker 镜像瘦身实战:从 1.2G 到 80MB 的五个优化步骤
ci/cd·docker
程序员老赵7 天前
10 分钟部署 OpenCode:Docker 一键安装,浏览器打开就能用 AI 写代码(附完整命令与排错)
docker·容器·ai编程
WangMingHua1117 天前
LM Studio Docker 部署——本地大模型一键启动
docker
曲幽8 天前
别再用网页翻译看源码了!你的私人翻译神器LibreTranslate,部署避坑指南来了
python·docker·web·pot·translate·libretranslate·arogstranslate
武子康10 天前
调查研究-183 Apple container:Mac 上用轻量 VM 跑 Linux 容器,Swift 会改写本地容器体验吗?
docker·容器·apple
Inhand陈工13 天前
基于台达PLC与映翰通IG502的智慧水产养殖精准投喂与远程运维解决方案
运维·人工智能·物联网·阿里云·信息与通信
Alsn8613 天前
等待学习-学习目录:Docker 容器安全攻防
学习·安全·docker