为github的docker源提速
下载zlib(github上的)非常幸苦,速度极慢
找到了大神的文章:加速docker pull
有什么用
为github的docker源提速,比如:
ghcr.io/zlib-searcher/zlib-searcher:latest
ghcr.io/puzzithinker/zlib-searcher:master
怎么用
- 配置http-proxy.conf
mkdir -p /etc/systemd/system/docker.service.d
vim /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://192.168.1.1:7890"
- 配置https-proxy.conf
vim /etc/systemd/system/docker.service.d/https-proxy.conf
[Service]
Environment="HTTPS_PROXY=http://192.168.1.1:7890"
#这个设置是难点,踩坑折腾了半小时左右,一直监控着clash.meta的UI,docker pull过程到底有没有走proxy,设置对了以后,速度果然一下子,嗖.....
- 重启服务
shell
sudo systemctl daemon-reload
sudo systemctl restart docker
-
监控一下是否正常走了设置的代理
-
当proxy出现故障时, docker-compose up 或者 pull 会报错:
[+] Running 1/0
✘ meta Error 0.0s
Error response from daemon: Get "https://registry-1.docker.io/v2/": proxyconnect tcp: dial tcp 192.168.6.116:7890: connect: connection refused
解决办法可以是删除上面的代理配置, 重启docker服务.
相关内容
灵感来源
https://zu1k.com/posts/coding/speedup-docker-pull/#%E4%B8%BAdocker%E8%AE%BE%E7%BD%AE%E4%BB%A3%E7%90%86
假如Docker image的源repository被删除了
You will need to save the Docker image as a tar file:
> docker save -o <path for generated tar file> <image name>
Then copy your image to a new system with regular file transfer tools such as cp, scp, or rsync (preferred for big files). After that you will have to load the image into Docker:
> docker load -i <path to image tar file>
You should add filename (not just directory) with -o, for example:
> docker save -o c:/myfile.tar centos:16
PS: You may need to sudo all commands.
https://stackoverflow.com/questions/23935141/how-to-copy-docker-images-from-one-host-to-another-without-using-a-repository
将docker内文件拷贝到本地文件夹内
docker cp 容器Id或name:容器内路径 本地文件夹路径
docker cp containername:/usr/share/nginx/html /volume2/KingchuxingSSD512G/docker/compose/it-tools/html
反之亦然
NAS中无法使用该文方案
失败错误:
ERROR: error pulling image configuration: Get "https://production.cloudflare.docker.com/registry-v2/docker
/registry/v2/blobs/sha256/fe/fe9002effde28797931563f042679ea1e505026f90ddbd737ba9cc3d425f7b3a/data?verify=
1719848198-tPisG8yWTSP%2FS87aF2Ea40NhcOk%3D": dial tcp 157.240.12.35:443: i/o timeout
环境NAS中 docker pull alfg/nginx-rtmp
docker pull 如何走代理?
执行像上面那样的步骤
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl restart docker
Failed to restart docker.service: Unit docker.service failed to load: No such file or directory.
暂时放弃了该NAS中的docker,目前无法解决这个错误。(等待第二天自动重启后查看状态)
- 切换到debian中可以正常pull(已经打了这个‘补丁’)
/www/server/panel/data/compose/
-
或者 在docker-compose文件中 使用国内可用的镜像地址
-
比如:registry.cn-hangzhou.aliyuncs.com/ossrs/srs:5
Docker 通过ffmpeg将rtsp转码为rtmp进行播放
整个流程说明:rtsp转rtmp直播.md
切换docker镜像到docker run -d -p 1935:1935 -p 8080:8080 alqutami/rtmp-hls
version: "3"
services:
rtmp-hls:
ports:
- 1935:1935
- 8113:8080
image: alqutami/rtmp-hls
配置 nginx-hls.conf
nginx-hls.conf
....
是否需要做配置?
上面这个方案的docker pull成功,但是无法正常启动;切换:
version: "3"
services:
rtmp-hls:
ports:
- 1935:1935
- 8113:8080
image: polinux/rtmp-hls
推流
ffmpeg -i "rtsp://admin:dahua123@192.168.6.126:554" -f flv -r 25 -an rtmp://192.168.6.116:1935/live/test


推流
ffmpeg -i "rtsp://a:a@192.168.6.126:554" -f flv -r 25 -an rtmp://192.168.6.116:1935/stream/test
使用镜像自带的players播放
- To play RTMP content (requires Flash):
http://localhost:8080/players/rtmp.html - To play HLS content:
http://localhost:8080/players/hls.html - To play HLS content using hls.js library:
http://localhost:8080/players/hls_hlsjs.html - To play DASH content:
http://localhost:8080/players/dash.html - To play RTMP and HLS contents on the same page:
http://localhost:8080/players/rtmp_hls.html
docker pull 中EOF错误的解决办法(之一)
root@debian12:~/synctv# docker-compose up
WARN[0000] /root/synctv/docker-compose.yml: `version` is obsolete
[+] Running 1/1
✘ synctv Error Get "https://registry-1.docker.io/v2/": EOF 26.2s
Error response from daemon: Get "https://registry-1.docker.io/v2/": EOF
可通过代理docker的流量来解决这个错误, 或者添加墙内的镜像地址:
中国的docker镜像地址
local country=$(curl -s ipinfo.io/country)
if [ "$country" = "CN" ]; then
cat > /etc/docker/daemon.json << EOF
{
"registry-mirrors": [
"https://docker.1ms.run",
"https://docker.m.ixdev.cn",
"https://hub.rat.dev",
"https://dockerproxy.net",
"https://docker-registry.nmqu.com",
"https://docker.amingg.com",
"https://docker.hlmirror.com",
"https://hub1.nat.tf",
"https://hub2.nat.tf",
"https://hub3.nat.tf",
"https://docker.m.daocloud.io",
"https://docker.kejilion.pro",
"https://docker.367231.xyz",
"https://hub.1panel.dev",
"https://dockerproxy.cool",
"https://docker.apiba.cn",
"https://proxy.vvvv.ee"
]
}
EOF
fi
Mac系统彻底关闭或卸载Docker的命令
发现MAC下的docker后台占用了超多的内存, 要避免这种严重吃内存的尴尬局面

launchctl list | grep docker
- 0 com.docker.helper
69504 0 application.com.docker.docker.1558478.1558763
launchctl stop application.com.docker.docker.1558478.1558763
完整指南
osascript -e ‘quit app “Docker”
ps aux | grep -i docker | awk ‘{print $2}’ | xargs kill -9
下面是删除/卸载
sudo rm -rf /Applications/Docker.app
cd /usr/local/bin/
sudo rm -rf docker docker-compose docker-machine docker-credential- com.docker. hub-tool kube vpnkit*
rm -rf ~/Library/Application\ Support/Docker\ Desktop
rm -rf ~/Library/Group\ Containers/group.com.docker
rm -rf ~/.docker
rm -rf ~/Library/Caches/com.docker.docker
rm -rf ~/Library/Preferences/com.docker.docker.plist
rm -rf ~/Library/Logs/Docker\ Desktop

发表回复