10分钟在Windows11下Ubuntu内安装docker-Version28.51

系统环境

Windows 11 家庭中文版,版本号 24H2

Docker 安装与配置步骤

更新系统

bash 复制代码
sudo apt-get update
sudo apt-get upgrade

安装依赖工具

bash 复制代码
sudo apt-get install ca-certificates curl gnupg lsb-release

添加 Docker 官方 GPG 密钥

bash 复制代码
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

设置 Docker 仓库(使用清华镜像源)

bash 复制代码
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
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

安装 Docker 核心组件

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

配置 Docker 镜像加速

编辑 /etc/docker/daemon.json,添加国内镜像源:

json 复制代码
{
  "registry-mirrors": [
    "https://hub-mirror.c.163.com",
    "https://mirror.baidubce.com",
    "https://registry.docker-cn.com"
  ]
}

重启 Docker 服务

bash 复制代码
sudo systemctl daemon-reload
sudo systemctl restart docker

验证安装

运行测试容器:

bash 复制代码
sudo docker run hello-world

查看 Docker 信息

bash 复制代码
sudo docker info

历史命令记录

bash 复制代码
history
相关推荐
新时代牛马15 分钟前
Linux 系统调用与IPC 完整篇:从syscall 入口、VDSO 到pipe/shm/futex 选型
linux·运维·服务器
fpcc2 小时前
计算机原理—Linux是如何加载可执行文件到内存
linux
野熊佩骑2 小时前
Kubernetes实战系列文章(三) 之 K8S运维常用命令
linux·运维·docker·微服务·云原生·容器·kubernetes
码农客栈2 小时前
linux 设备树下的 platform 驱动编写
linux
小HANN2 小时前
Linux建站实战:CentOS7+LNMP 从零部署 ECShop 开源电商系统
linux·运维·服务器·经验分享
做运维的阿瑞2 小时前
Shell 脚本经典十三问:引号、变量、子 Shell 与重定向一次讲清问:引号、变量、子 Shell 与重定向一次讲清
linux·tcp/ip
昌原的儿子LEO2 小时前
Linux IO多路复用与SQLite数据库核心知识点总结
linux·数据库·oracle
GeW2 小时前
RHCE通关秘籍:从零基础到高分拿证的5个加速器
linux
前端世界3 小时前
基于 Linux 的本地 AI 智能问答平台搭建实践 —— Ollama + FastAPI + Nginx 实现本地大模型 Web 服务
linux·运维·人工智能
倔强的石头1063 小时前
【Linux指南】动静态库系列(七):符号表与重定位:链接器如何把函数调用接起来
linux·前端·javascript