惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
F
Fortinet All Blogs
B
Blog
GbyAI
GbyAI
P
Proofpoint News Feed
量子位
The Register - Security
The Register - Security
宝玉的分享
宝玉的分享
大猫的无限游戏
大猫的无限游戏
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
B
Blog RSS Feed
WordPress大学
WordPress大学
Recorded Future
Recorded Future
Recent Announcements
Recent Announcements
V
Vulnerabilities – Threatpost
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Secure Thoughts
雷峰网
雷峰网
Stack Overflow Blog
Stack Overflow Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Webroot Blog
Webroot Blog
AWS News Blog
AWS News Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
The GitHub Blog
The GitHub Blog
爱范儿
爱范儿
O
OpenAI News
月光博客
月光博客
H
Hacker News: Front Page
S
Security Affairs
W
WeLiveSecurity
The Hacker News
The Hacker News
aimingoo的专栏
aimingoo的专栏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Help Net Security
Help Net Security
MongoDB | Blog
MongoDB | Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Docker
T
The Blog of Author Tim Ferriss
Spread Privacy
Spread Privacy
Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
S
Securelist
Microsoft Azure Blog
Microsoft Azure Blog
TaoSecurity Blog
TaoSecurity Blog
T
Threat Research - Cisco Blogs
M
MIT News - Artificial intelligence
A
About on SuperTechFans

十二的编程笔记

26 年新年前 vibe coding 感慨 - 随便写写 社区驱动型流量的转化效能与质量特征分析 - AI - 计算机科学 ClawdBot 祛魅 2 小时安装 + 实际体验 还需再练练 - AI - 计算机科学 golang 标准库源码解析 - runtime2 GMP - Lib - GO - 计算机科学 BCTF2025-AI - BCTF2025 - CTF - 计算机科学 BCTF2025-MISC-01~08 - BCTF2025 - CTF - 计算机科学 golang 标准库源码解析 - channel - Lib - GO - 计算机科学 golang 标准库源码解析 - Context - Lib - GO - 计算机科学 golang 多版本环境控制 - GO - 计算机科学 cloudflare connect 踩坑记录 - Project - 计算机科学 BCTF2024-WEB-01~08 - BCTF2024 - CTF - 计算机科学 BCTF2024-MISC - BCTF2024 - CTF - 计算机科学 Hexo 使用 github Action 进行发布 - Project - 计算机科学 BCTF2024-IOT - BCTF2024 - CTF - 计算机科学 BCTF2024-REVERSE - BCTF2024 - CTF - 计算机科学 分布式事务 - 高可用 - 计算机科学 分布式 CAP 和 BASE 理论 简介 - 高可用 - 计算机科学 GitHub Copilot 封号及退款过程 - Project - 计算机科学 记录一次 innodb 全表 update - MySQL - Database - 计算机科学
搭建使用 Cloudflare Worker 的 Docker 镜像 - Project - 计算机科学
本文作者: Twelveeee @十二的编程笔记 · 2024-07-07 · via 十二的编程笔记

项目地址:GitHub - cmliu/CF-Workers-docker.io

# 前言

由于众所周知的原因,docker 没办法比较好的访问。本文介绍如何使用 Cloudflare Workers 搭建 Docker 代理服务。

于是尝试使用了阿里云的镜像服务,本以为需要注册效果会好点,拉完了镜像才发现镜像是踏马 21 年的镜像....

# 准备

按照本文,您需要

  • 一个域名(需要转给 Cloudflare ),国内域名不行。

  • 一个 Cloudflare 账户(免费)

或者也可以直接用我的服务

https://docker-proxy.twelvelocal.uk/

到本文最后看使用方式

# 绑定域名

# 构建 worker

在 Cloudflare Workers 中创建一个新的 Worker。

起一个比较好听的名字。

这时候就能通过 worker 的域名访问了

但是由于众所周知的问题,这个域名是没办法在没有魔法的机器上访问的。

这就引出了下一步,需要给 worker 绑定一个域名

# 关联 worker 域名

在 Cloudflare 控制台首页选择你的域名。

创建 DNS 记录,输入域名前缀和 IP 地址(IP 地址可以随便填写,关键是 Proxy 需要勾选)。

保存后,添加 Worker 的路由

格式为 xxx.example.com/*

后面这个 /* 不能省略

等待几分钟后,检查是否成功。

出现了。

# 测试连接

linux 访问这个域名老是不成功,尝试配置 Cloudflare 的 DNS

# Linux DNS

echo -e "nameserver 1.1.1.1\nnameserver 1.0.0.1" | sudo tee /etc/resolv.conf

测试命令

$ ping baidu.com
PING baidu.com (39.156.66.10) 56(84) bytes of data.
64 bytes from 39.156.66.10 (39.156.66.10): icmp_seq=1 ttl=50 time=9.29 ms
64 bytes from 39.156.66.10 (39.156.66.10): icmp_seq=2 ttl=50 time=8.97 ms
$ curl http://docker-rouert.twelvelocal.uk/1
Hello World!

# 更新 worker 代码

复制 https://github.com/cmliu/CF-Workers-docker.io/blob/main/_worker.js 的代码进来,粘贴到代码块,并且更改域名

测试效果

# 使用方式

# 1. 官方镜像路径前面加域名

docker pull docker.fxxk.dedyn.io/stilleshan/frpc:latest
docker pull docker.fxxk.dedyn.io/library/nginx:stable-alpine3.19-perl

# 2. 一键设置镜像加速

修改文件 /etc/docker/daemon.json (如果不存在则创建)

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://docker.fxxk.dedyn.io"]  # 请替换为您自己的Worker自定义域名
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

测试效果