安装docker

2025-04-01ubuntu-24.04.1 上安装 docker

参考自 https://www.sysgeek.cn/install-docker-ubuntu/

安装前置

sudo apt update
sudo apt install apt-transport-https curl

添加gpg密钥

这一步遇到问题,可能失败,失败后会在 /etc/apt/keyrings/docker.gpg 写一个空文件,需要删除后重试

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

添加仓库

虽然格式和apt自带的不一致,但是能用

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

更新软件包列表

sudo apt update

安装

这一步下载很慢,选择给apt设置代理(http_proxy环境变量居然无效) 创建文件 /etc/apt/apt.conf.d/proxy.conf 并写入

Acquire::http::Proxy "http://192.168.1.1:7890/";
Acquire::https::Proxy "http://192.168.1.1:7890/";
# 安装
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

检查docker状态

sudo systemctl is-active docker

hello world

下不动哈哈哈
https://cloud.tencent.com/developer/article/2485043 找到了可用的两个镜像源

编辑文件 /etc/docker/daemon.json

{
"registry-mirrors": [
"https://docker.xuanyuan.me",
"https://docker.1ms.run"
]
}

配置完成后

sudo systemctl daemon-reload
sudo systemctl restart docker
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇