Skip to content

Commit c605250

Browse files
committed
update
1 parent eea9793 commit c605250

7 files changed

+76
-0
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
164164

165165
## Docker
166166

167+
- [苹果芯片的 Mac 电脑构建 x86 镜像](docker/build-x86-image-with-apple-silicon.md)
167168
- [ContainerD OverlayFS](docker/containerd-overlayfs.md)
168169
- [Containerd](docker/containerd.md)
169170
- [容器里的 Core Dump](docker/core-dump-in-container.md)
@@ -307,6 +308,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
307308

308309
- [Github Markdown 中的锚点引用](github/anchor-in-github-markdown.md)
309310
- [构建 github page](github/build-page.md)
311+
- [Github 下载最新 release 文件](github/download-latest-release-file.md)
310312
- [github 中 markdown 折叠文本](github/fold-text-in-github.md)
311313
- [如何在 github 项目里搜索代码](github/how-to-use-github-to-browse-codes.md)
312314
- [在 Github Markdown 中如何填写图片的链接](github/relative-link-in-github-markdown.md)
@@ -767,6 +769,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
767769
- [MacOS 彻底删除搜狗输入法](others/delete-sogou-input-in-macos.md)
768770
- [dropbear](others/dropbear.md)
769771
- [Duplicati](others/duplicati.md)
772+
- [在浏览器里启动 DoH](others/enable-doh-in-browser.md)
770773
- [文件命名,下划线还是中划线?](others/file-naming-with-underscores-and-dashes.md)
771774
- [fonts.googleapis.com 不可访问](others/fonts.googleapis.com-is-inaccessible.md)
772775
- [fzf](others/fzf.md)

android/termux.md

+10
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,13 @@ apt、dpkg 和 Debian 的一模一样,尽量少做修改,只用来查询。
3434
根据[官方 WIKI](https://github.com/termux/termux-app/wiki/Termux-on-android-5-or-6) 可知,它在 [Github Workfloww](https://github.com/termux/termux-app/actions/workflows/debug_build.yml?query=branch%3Amaster+event%3Apush) 里编译了支持 Android 5/6 的 Termux App。
3535

3636
点进任意成功的 build。在 Artifacts 有列出所有的构建结果文件。选择文件名包含 `android-5` 的文件,支持 Android 5 或 Android 6。
37+
38+
## 修改 DNS 设置
39+
40+
截止 2024/04/18,我使用的 v0.118.0 版本的 Termux,默认 DNS 是 8.8.8.8,并非当前系统所设置的 DNS。
41+
并且也不存在 /etc/resolv.conf 文件。
42+
43+
解决方法:
44+
45+
1. `pkg install resolv-conf` 确保已安装 resolv-conf 包。
46+
2. Termux 使用的 resolv.conf 路径在 `/data/data/com.termux/files/usr/etc/resolv.conf`,直接修改内容即可,不需要 root 权限。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# 苹果芯片的 Mac 电脑构建 x86 镜像
2+
3+
当使用苹果芯片的 Mac 电脑,docker build/pull/run 默认操作的都是 arm64 架构的镜像。
4+
5+
但某些时候会遇到问题,比如 gcc-multilib 和 g++-mulitlib 这个交叉编译工具就不提供 arm64 架构的程序,只能在 x86 环境安装使用。因此在苹果芯片的 Mac 电脑的容器里执行 `apt install gcc-multilib` 就会失败,报错说找不到这个包。
6+
7+
解决方法很简单,加上 `--platform linux/amd64` 参数即可。
8+
9+
- `docker run -it --rm --platform linux/amd64 alpine uname -a`
10+
- `docker build --platform linux/amd64 .`

docker/docker-for-mac.md

+15
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,18 @@ docker for mac 的配置在 `~/Library/Group\ Containers/group.com.docker/settin
1313
等待解决 https://github.com/docker/for-mac/issues/6082
1414

1515
解决方法:在别的窗口使用 `docker stop` 命令来关闭容器。或者到 Docker Desktop 里关闭容器。
16+
17+
18+
## OrbStack
19+
20+
如果使用 Mac,推荐安装 OrbStack 代替 Docker Desktop。它更轻量级,可以创建虚拟机以及 Docker。
21+
22+
### OrbStack Linux
23+
24+
可以在终端使用 `orb` 命令进入虚拟机。
25+
26+
### OrbStack Docker
27+
28+
`orb config docker` 可以配置 docker。
29+
或者编辑 ~/.orbstack/config/docker.json 文件。
30+
修改后需要重启 docker。`orb restart docker`

docker/multi-arch-build.md

+13
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,16 @@ docker buildx commands:
6464
**注意**,用户必须加上 `--push` 参数,它会自动 push 构建好的镜像到 docker hub。由于 docker buildx build 构建的多架构的镜像只会保留最后一份架构的镜像在本机,用户没法用 `docker push` 来提交多架构镜像。
6565

6666
详见 https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md
67+
68+
## TARGETPLATFORM 变量
69+
70+
`--platform` 传递的参数会自动注入到 TARGETPLATFORM 环境变量里。
71+
方便在 [RUN heredoc](./dockerfile.md#dockerfile-支持-heredoc) 里使用条件判断。
72+
73+
```dockerfile
74+
FROM alpine
75+
ARG TARGETPLATFORM
76+
RUN echo "I'm building for $TARGETPLATFORM"
77+
```
78+
79+
详见 https://docs.docker.com/reference/dockerfile/#automatic-platform-args-in-the-global-scope
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Github 下载最新 release 文件
2+
3+
URL 格式:
4+
5+
- `https://github.com/$USER/$PROJECT/releases/latest/download/$FILE`
6+
- `https://github.com/$USER/$PROJECT/releases/download/$VERSION/$FILE`

others/enable-doh-in-browser.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# 在浏览器里启动 DoH
2+
3+
Chrome、Firefox、Edge、Brave 浏览器参考[这篇文章](https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https/encrypted-dns-browsers/)
4+
5+
## Firefox Nightly
6+
7+
手机版 Firefox 只有 Nightly 版本可以调整。
8+
9+
1. 地址栏输入 `about:config` 回车进入。
10+
2. 搜索 `network.trr.mode` 值改为 2。
11+
- 0 - Default value in standard Firefox installations
12+
- 1 - DoH is enabled, but Firefox picks if it uses DoH or regular DNS based on which returns faster query responses
13+
- 2 - DoH is enabled, and regular DNS works as a backup
14+
- 3 - DoH is enabled, and regular DNS is disabled
15+
- 5 - DoH is disabled
16+
3. 搜索 `network.trr.uri` 改为 DoH 地址。比如 `https://cloudflare-dns.com/dns-query`
17+
4. (可选) 搜索 `network.trr.bootstrapAddress`,调整 bootstrap dns 地址。
18+
19+
参考 https://wiki.mozilla.org/Trusted_Recursive_Resolver

0 commit comments

Comments
 (0)