docs: 添加 Docker 代理配置笔记,清理文章 frontmatter 中不需要的 categories 字段

This commit is contained in:
yuany3721 2026-04-04 14:39:51 +08:00
parent b5138b2d91
commit 68a428efeb
86 changed files with 92 additions and 170 deletions

View File

@ -4,8 +4,6 @@ createTime: 2021/08/29
tags:
- Centos
- Windows
categories:
- blog
---
##

View File

@ -4,8 +4,6 @@ createTime: 2023/07/17 17:36:48
tags:
- Ubuntu
- LXD
categories:
- blog
---
[[toc]]

View File

@ -4,8 +4,6 @@ createTime: 2023/07/28 20:50:46
author: yuany3721 danc
tags:
- LLM
categories:
- blog
---
> **注意:**

View File

@ -3,8 +3,6 @@ title: ZeroTier组网的简单应用
createTime: 2024/07/01 23:06:45
tags:
- ZeroTier
categories:
- blog
---
## 需求

View File

@ -3,8 +3,6 @@ title: DNS解析类型
createTime: 2021/08/30
tags:
- DNS
categories:
- 随记
---
1. AAddress记录 将域名指向 IP 地址Ipv4

View File

@ -5,8 +5,6 @@ createTime: 2021/09/28
tags:
- gcc
- 转载
categories:
- 随记
---
> 作者:一见

View File

@ -2,8 +2,6 @@
title: 利用私钥生成公钥
createTime: 2022/04/18
tags:
categories:
- 随记
---
因为不小心把 id_rsa.pub 丢了,但是又不想改 id_rsa。。

View File

@ -2,8 +2,6 @@
title: dB、dBm、dBw
createTime: 2022/08/01 15:05:48
tags:
categories:
- 随记
---
> 参考:中科院物理所[100 分钟看懂 dB、dBm、dBw 的区别](https://baijiahao.baidu.com/s?id=1722028647203360593)

View File

@ -2,8 +2,6 @@
title: office使用kms激活0x80080005问题
createTime: 2022/11/11 15:36:55
tags:
categories:
- 随记
---
> 参考[YerongAI/Office-Tool/Issues#216](https://github.com/YerongAI/Office-Tool/issues/216)

View File

@ -2,8 +2,6 @@
title: 配置ssh免密登录
createTime: 2023/08/07 09:50:58
tags:
categories:
- 随记
---
机器 A 访问 机器 B

View File

@ -3,8 +3,6 @@ title: docker安装gitlab
createTime: 2022/02/19
tags:
- Docker
categories:
- 随记
---
## 安装

View File

@ -3,8 +3,6 @@ title: dockerfile里修改pip和apt源
createTime: 2023/06/25 21:13:41
tags:
- Docker
categories:
- 随记
---
## apt

View File

@ -4,8 +4,6 @@ createTime: 2023/06/27 09:54:12
tags:
- docker
- Ubuntu
categories:
- 随记
---
对于无图形界面的 Ubuntu Server直接安装[Dokcer Engine](https://docs.docker.com/engine/install/ubuntu/)就可以。

View File

@ -3,8 +3,6 @@ title: docker安装webdav
createTime: 2023/06/28 20:36:10
tags:
- Docker
categories:
- 随记
---
```bash

View File

@ -3,8 +3,6 @@ title: Docker换源
createTime: 2024/08/01 15:32:15
tags:
- Docker
categories:
- 随记
---
修改`/etc/docker/daemon.json`:

View File

@ -4,8 +4,6 @@ createTime: 2024/10/26 19:02:54
tags:
- ZeroTier
- Docker
categories:
- 随记
---
## 前言

View File

@ -4,8 +4,6 @@ createTime: 2025/03/17 15:25:38
tags:
- Docker
- Windows
categories:
- 随记
---
参考:[IBM Docker](https://www.ibm.com/docs/en/addi/6.1.0?topic=prerequisites-configuring-docker-engine-listen-tcp-socket)

View File

@ -3,8 +3,6 @@ title: Docker修改默认网段
createTime: 2025/03/27 22:20:49
tags:
- Docker
categories:
- 随记
---
修改`daemon.json`,加入以下配置:

View File

@ -3,8 +3,6 @@ title: Docker安装Gitea
createTime: 2025/04/23 17:54:18
tags:
- Docker
categories:
- 随记
---
# Docker安装Gitea

View File

@ -3,8 +3,6 @@ title: 使用Docker Compose构建MQTT消息记录服务
createTime: 2025/06/19 23:30:29
tags:
- Docker
categories:
- 随记
---
## 思路

View File

@ -0,0 +1,92 @@
---
title: docker pull使用代理
createTime: 2026/04/04 14:28:00
tags:
- Docker
- Proxy
---
## 问题现象
当 Docker 所在的环境需要通过代理服务器和互联网连通时,直接拉取镜像会遭遇失败:
```bash
$ docker pull busybox
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
while waiting for connection (Client.Timeout exceeded while awaiting headers)
```
## 原因分析
拉取镜像是 **docker daemon** 的职责,而不是 docker 客户端。因此,仅仅在 shell 中设置 `HTTP_PROXY` 环境变量是不够的,我们需要让 docker daemon 知道代理服务器的存在。
由于 docker daemon 由 **systemd** 管理,所以需要在 systemd 配置中设置代理环境变量。
## 解决方案
### 1. 创建 systemd 配置目录
```bash
sudo mkdir -p /etc/systemd/system/docker.service.d
```
### 2. 创建代理配置文件
新建文件 `/etc/systemd/system/docker.service.d/http-proxy.conf`
```ini
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:port"
Environment="HTTPS_PROXY=http://proxy.example.com:port"
```
:::tip
如果代理服务器需要认证,格式为:`http://username:password@proxy.example.com:port`
:::
### 3. 配置私有仓库绕过代理(可选)
如果有私有镜像仓库需要直连,添加 `NO_PROXY` 配置:
```ini
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:port"
Environment="HTTPS_PROXY=http://proxy.example.com:port"
Environment="NO_PROXY=your-registry.com,10.10.10.10,*.example.com"
```
多个地址用逗号分隔,支持通配符 `*`。如果设置 `NO_PROXY=*`,则所有请求都不通过代理。
### 4. 重载配置并重启 Docker
```bash
sudo systemctl daemon-reload
sudo systemctl restart docker
```
### 5. 验证配置
检查环境变量是否正确配置:
```bash
sudo systemctl show --property=Environment docker
```
也可以通过 `docker info` 查看代理配置是否生效。
## 常见误区
Docker 官方有一篇关于[配置代理的文档](https://docs.docker.com/network/proxy/#configure-the-docker-client),但那篇文档讲的是如何给**运行中的容器**配置代理环境变量,而不是给 docker daemon 配置代理来拉取镜像。如果按照那篇文档在 `~/.docker/config.json` 中配置,是无法解决拉取镜像超时的问题的。
## 总结
- 拉取镜像是 docker daemon 的职责
- 需要在 systemd 层面配置 `HTTP_PROXY``HTTPS_PROXY` 环境变量
- 配置路径:`/etc/systemd/system/docker.service.d/http-proxy.conf`
- 配置完成后需要执行 `daemon-reload``restart docker`
## 参考
- [Docker 官方文档 - systemd 代理配置](https://docs.docker.com/config/daemon/systemd/#httphttps-proxy)
- [Stack Overflow - Can't pull docker image behind a proxy](https://stackoverflow.com/questions/69047394/cant-pull-docker-image-behind-a-proxy)

View File

@ -3,8 +3,6 @@ title: gitpull提示stash
createTime: 2022/04/18
tags:
- git
categories:
- 随记
---
## Git: pull 时提示 Please commit your changes or stash them before you merge

View File

@ -3,8 +3,6 @@ title: gitignore
createTime: 2022/04/28
tags:
- git
categories:
- 随记
---
## .gitignore 相关规则

View File

@ -3,8 +3,6 @@ title: git走代理
createTime: 2022/11/03 16:08:24
tags:
- git
categories:
- 随记
---
## 临时代理

View File

@ -3,8 +3,6 @@ title: git远程仓库与本地建立联系失败refusing to merge unrelated his
createTime: 2023/07/06 22:47:16
tags:
- git
categories:
- 随记
---
通常会出现在远端仓库有文件、本地仓库也有文件的时候,是因为这两个仓库在 sync 之前根本没有建立起来联系

View File

@ -3,8 +3,6 @@ title: github ssh timeout
createTime: 2024/01/21 20:00:26
tags:
- git
categories:
- 随记
---
[参考](https://github.com/orgs/community/discussions/88410#discussioncomment-8151064)

View File

@ -3,8 +3,6 @@ title: git身份认证成功但public key permission denied
createTime: 2024/07/02 15:24:51
tags:
- git
categories:
- 随记
---
参考[Authenticated but can't fetch or push](https://github.com/orgs/community/discussions/27456)

View File

@ -3,8 +3,6 @@ title: Ubuntu设置屏幕分辨率及屏幕翻转
createTime: 2021/09/24
tags:
- Ubuntu
categories:
- 随记
---
> Version: Ubuntu 18.04.6 LTS

View File

@ -3,8 +3,6 @@ title: nginx+php上传文件配置
createTime: 2021/09/25
tags:
- linux
categories:
- 随记
---
- 设置`php.ini`

View File

@ -3,8 +3,6 @@ title: Ubuntu配置搜狗输入法
createTime: 2021/09/27
tags:
- Ubuntu
categories:
- 随记
---
> Version: Ubuntu 20.04.3 LTS

View File

@ -3,8 +3,6 @@ title: Ubuntu配置ssh和sftp
createTime: 2021/09/28
tags:
- Ubuntu
categories:
- 随记
---
## 安装

View File

@ -3,8 +3,6 @@ title: Ubuntu防火墙操作
createTime: 2021/09/28
tags:
- Ubuntu
categories:
- 随记
---
```bash

View File

@ -3,8 +3,6 @@ title: Ubuntu配置阿里云ddns
createTime: 2021/09/29
tags:
- Ubuntu
categories:
- 随记
---
1. 生成阿里云 access key **注意:不能使用 ram 子用户**

View File

@ -3,8 +3,6 @@ title: ubuntu设置时区
createTime: 2021/09/30
tags:
- Ubuntu
categories:
- 随记
---
`sudo dpkg-reconfigure tzdata`

View File

@ -3,8 +3,6 @@ title: Ubuntu startup设置开机自启命令
createTime: 2021/09/30
tags:
- Ubuntu
categories:
- 随记
---
> Version: Ubuntu Server 20.04.3 LTS

View File

@ -3,8 +3,6 @@ title: Ubuntu配置mariadb
createTime: 2021/09/30
tags:
- Ubuntu
categories:
- 随记
---
## 安装

View File

@ -3,8 +3,6 @@ title: ubuntu下多版本openjdk配置
createTime: 2022/05/11
tags:
- Ubuntu
categories:
- 随记
---
```bash

View File

@ -3,8 +3,6 @@ title: Ubuntu设置swap分区
createTime: 2022/11/02 16:22:28
tags:
- Ubuntu
categories:
- 随记
---
**通常Ubuntu Server 安装完成后已经自动配置了 swap 分区,使用`sudo swapon --show`或者`free -m`查看**

View File

@ -3,8 +3,6 @@ title: ssh config
createTime: 2022/11/03 16:08:27
tags:
- ssh
categories:
- 随记
---
编辑`~/.ssh/config`文件

View File

@ -3,8 +3,6 @@ title: apt换源
createTime: 2023/01/10 14:54:26
tags:
- Ubuntu
categories:
- 随记
---
1. 查看 codename

View File

@ -4,8 +4,6 @@ createTime: 2023/05/08 13:00:12
tags:
- linux
- certbot
categories:
- 随记
---
`Ubuntu 22.04.01 LTS`为例

View File

@ -3,8 +3,6 @@ title: Ubuntu Server基本配置
createTime: 2023/06/20 21:10:07
tags:
- ubuntu
categories:
- 随记
---
## 配置联网超时

View File

@ -3,8 +3,6 @@ title: Ubuntu设置时区
createTime: 2023/06/24 18:55:29
tags:
- Ubuntu
categories:
- 随记
---
```bash

View File

@ -3,8 +3,6 @@ title: bash脚本格式问题
createTime: 2023/06/26 12:11:42
tags:
- linux
categories:
- 随记
---
运行 bash 脚本时报错`-bash: ./create-lxc-template.bash: /bin/bash^M: bad interpreter: No such file or directory`

View File

@ -3,8 +3,6 @@ title: ubuntu安装图形界面并按需启动
createTime: 2023/06/29 00:28:24
tags:
- ubuntu
categories:
- 随记
---
1. 安装图形界面和 xrdp

View File

@ -3,8 +3,6 @@ title: 回退Ubuntu Linux kernel
createTime: 2024/09/04 17:57:37
tags:
- ubuntu
categories:
- 随记
---
## 背景

View File

@ -3,8 +3,6 @@ title: 使用zfs存储池的lxc容器扩容
createTime: 2024/12/24 08:59:05
tags:
- ubuntu
categories:
- 随记
---
```bash

View File

@ -3,8 +3,6 @@ title: micropython + vscode配置ESP32开发环境
createTime: 2023/06/05 16:37:09
tags:
- esp32
categories:
- 随记
---
1. 准备工作

View File

@ -3,8 +3,6 @@ title: python依赖固化
createTime: 2022/04/17
tags:
- Python
categories:
- 随记
---
## 生成 requirements.txt

View File

@ -3,8 +3,6 @@ title: 修改pip源
createTime: 2022/10/19 16:34:09
tags:
- python
categories:
- 随记
---
1. 临时换源

View File

@ -3,8 +3,6 @@ title: python虚拟环境配置
createTime: 2024/07/31
tags:
- python
categories:
- 随记
---
1. Ubuntu

View File

@ -3,8 +3,6 @@ title: win10多版本openjdk配置
createTime: 2022/04/24
tags:
- Windows
categories:
- 随记
---
# 生成 jre

View File

@ -3,8 +3,6 @@ title: win10配置maven
createTime: 2022/04/24
tags:
- Windows
categories:
- 随记
---
## 配置 PATH

View File

@ -3,8 +3,6 @@ title: win10配置gradle
createTime: 2022/04/25
tags:
- Windows
categories:
- 随记
---
## 配置 PATH

View File

@ -3,8 +3,6 @@ title: powershell修改提示中文件路径
createTime: 2022/05/18 21:18:57
tags:
- Windows
categories:
- 随记
---
参考[hiding-the-full-file-path-in-a-powershell-command-prompt-in-vscode](https://stackoverflow.com/questions/52107170/hiding-the-full-file-path-in-a-powershell-command-prompt-in-vscode)

View File

@ -3,8 +3,6 @@ title: 使用nssm注册glances为服务运行
createTime: 2025/03/14 22:24:23
tags:
- Windows
categories:
- 随记
---
1. 下载 nssm

View File

@ -3,8 +3,6 @@ title: Windows PowerShell 在此系统上禁止运行脚本
createTime: 2025/03/14 22:05:52
tags:
- Windows
categories:
- 随记
---
Windows PowerShell 无法加载文件 xxx.ps1因为在此系统上禁止运行脚本

View File

@ -3,8 +3,6 @@ title: WordPress增加未分类类别查询
createTime: 2021/09/10
tags:
- Wordpress
categories:
- 随记
---
在主题编辑器中找到分类目录页面,添加如下代码:

View File

@ -3,8 +3,6 @@ title: 为WordPress创建子主题
createTime: 2021/09/16
tags:
- Wordpress
categories:
- 随记
---
## 子主题

View File

@ -3,8 +3,6 @@ title: WordPress开启debug模式
createTime: 2021/09/27
tags:
- Wordpress
categories:
- 随记
---
找到 WordPress 根目录下`wp-config.php`文件,找到`WP_DEBUG`字段改为 true增加`WP_DEBUG_DISPLAY`字段并设置为 true

View File

@ -3,8 +3,6 @@ title: WordPress全部文章分类页面
createTime: 2021/09/30
tags:
- Wordpress
categories:
- 随记
---
1. 复制一个 page.php 为 catlist.php

View File

@ -3,8 +3,6 @@ title: 用vite构建的vue3+ts中按需使用element-plus组件API
createTime: 2022/05/29 23:45:27
tags:
- Vue
categories:
- 随记
---
参考[manually-import](https://element-plus.org/en-US/guide/quickstart.html#manually-import)

View File

@ -3,8 +3,6 @@ title: 不使用vue-router实现简单路由跳转
createTime: 2022/05/29 23:40:45
tags:
- Vue
categories:
- 随记
---
参考[simple-routing-from-scratch](https://vuejs.org/guide/scaling-up/routing.html#simple-routing-from-scratch)

View File

@ -3,8 +3,6 @@ title: vite构建的vue3+ts改build路径
createTime: 2022/05/30 12:32:21
tags:
- Vue
categories:
- 随记
---
参考[build-outdir](https://vitejs.dev/config/#build-outdir)

View File

@ -3,8 +3,6 @@ title: npm换源
createTime: 2024/08/09 17:36:05
tags:
- npm
categories:
- 随记
---
```bash

View File

@ -2,8 +2,6 @@
title: 计算机的开机过程
createTime: 2013/10/31
tags:
categories:
- 杂谈
---
计算机的整个启动过程分成四个阶段。

View File

@ -3,8 +3,6 @@ title: 教育知识与能力【学习笔记1】
createTime: 2021/10/19
tags:
- 教育知识与能力
categories:
- 学习笔记
---
## 我国现代学制的沿革

View File

@ -3,8 +3,6 @@ title: 教育知识与能力【学习笔记2】
createTime: 2021/10/24
tags:
- 教育知识与能力
categories:
- 学习笔记
---
## 教育与教育学

View File

@ -3,8 +3,6 @@ title: 教育知识与能力【学习笔记3】
createTime: 2021/10/25
tags:
- 教育知识与能力
categories:
- 学习笔记
---
## 教育目的理论

View File

@ -3,8 +3,6 @@ title: 教育知识与能力【学习笔记4】
createTime: 2021/10/27
tags:
- 教育知识与能力
categories:
- 学习笔记
---
## 学习动机

View File

@ -3,8 +3,6 @@ title: 教育知识与能力【学习笔记5】
createTime: 2021/10/28
tags:
- 教育知识与能力
categories:
- 学习笔记
---
## 辨析题

View File

@ -3,8 +3,6 @@ title: 教育知识与能力【学习笔记6】
createTime: 2021/10/29
tags:
- 教育知识与能力
categories:
- 学习笔记
---
## 材料分析题

View File

@ -3,8 +3,6 @@ title: 教育知识与能力【学习笔记7】
createTime: 2021/10/30
tags:
- 教育知识与能力
categories:
- 学习笔记
---
## 简答题

View File

@ -3,8 +3,6 @@ title: 现代密码学理论与实践【学习笔记1】
createTime: 2021/09/17
tags:
- 现代密码学理论与实践
categories:
- 学习笔记
---
- 计算机安全:对于一个自动化的信息系统,采取保护措施确保信息系统资源(包括硬件、软件、固件、信息/数据和通信)的完整性、可用性和保密性

View File

@ -3,8 +3,6 @@ title: 现代密码学理论与实践【学习笔记2】
createTime: 2021/09/28
tags:
- 现代密码学理论与实践
categories:
- 学习笔记
---
- symmetric cipher model ![对称加密模型](./img/Pasted-6.png)

View File

@ -3,8 +3,6 @@ title: 现代密码学理论与实践【学习笔记3】
createTime: 2021/10/04
tags:
- 现代密码学理论与实践
categories:
- 学习笔记
---
- 流密码:每次加密数据流的一位或者一个字节。密文不仅与最初给定的算法和密钥有关,同时也与明文位置有关。

View File

@ -3,8 +3,6 @@ title: 科技论文写作【学习笔记1】
createTime: 2021/09/15
tags:
- 科技论文写作
categories:
- 学习笔记
---
## structure

View File

@ -3,8 +3,6 @@ title: TCSEC
createTime: 2021/09/21
tags:
- 信息安全
categories:
- 杂谈
---
## TCSEC

View File

@ -3,8 +3,6 @@ title: 网络安全【学习笔记1】
createTime: 2021/09/21
tags:
- 网络安全
categories:
- 学习笔记
---
## 网络安全概述

View File

@ -3,8 +3,6 @@ title: 美军网络战司令部
createTime: 2021/09/27
tags:
- 网络安全
categories:
- 杂谈
---
##

View File

@ -3,8 +3,6 @@ title: 震网
createTime: 2021/09/27
tags:
- 网络安全
categories:
- 杂谈
---
##

View File

@ -3,8 +3,6 @@ title: 网络安全【学习笔记2】
createTime: 2021/09/27
tags:
- 网络安全
categories:
- 学习笔记
---
## 密码学基础

View File

@ -3,8 +3,6 @@ title: 网络安全【学习笔记4】
createTime: 2021/10/23
tags:
- 网络安全
categories:
- 学习笔记
---
## 防火墙技术

View File

@ -3,8 +3,6 @@ title: 网络安全【学习笔记3】
createTime: 2021/10/23
tags:
- 网络安全
categories:
- 学习笔记
---
## 虚拟专用网VPN技术

View File

@ -3,8 +3,6 @@ title: 量子安全技术白皮书2020【学习笔记1】
createTime: 2021/08/06
tags:
- 量子安全技术白皮书
categories:
- 学习笔记
---
## 信息安全保障的关键要素

View File

@ -3,8 +3,6 @@ title: 量子安全技术白皮书2020【学习笔记2】
createTime: 2021/08/14
tags:
- 量子安全技术白皮书
categories:
- 学习笔记
---
## 量子计算对经典密码安全性的威胁