
Docker:Git-Pull是一个用于保持Git项目自动更新的Docker镜像。基于Debian测试版的精简镜像构建,内置Git工具,通过将Git项目目录挂载到容器的/git-project卷,实现自动拉取远程仓库的最新更改。同时支持挂载前置和后置脚本,在拉取操作前后执行自定义逻辑。
/pre-pull和/post-pull脚本,分别在拉取前(检测到新提交时)和拉取后执行将本地Git项目目录挂载到容器的/git-project卷,容器会自动拉取最新更改:
bashdocker run --rm -v /path/to/local/project:/git-project binfalse/git-pull
执行后,容器运行内置的git-pull脚本,更新/git-project目录中的项目。
通过挂载脚本文件到容器的特定路径,实现拉取前后的自定义操作:
git fetch检测到远程有新提交时,在git pull执行前运行git pull执行完成后运行示例(同时挂载前置和后置脚本):
bashdocker run --rm \ -v /path/to/local/project:/git-project \ -v /path/to/pre-script.sh:/pre-pull \ -v /path/to/post-script.sh:/post-pull \ binfalse/git-pull
注意:挂载的脚本文件需具有可执行权限(通过
chmod +x script.sh设置)
从SSH协议的Git仓库拉取代码需要配置SSH密钥和已知主机信息,步骤如下:
1. 创建SSH目录
bashmkdir /PATH/TO/SSHDIR
2. 生成无密码SSH密钥
在容器中生成SSH密钥(挂载SSH目录到容器的/root/.ssh):
bashdocker run --rm -it \ -v /path/to/local/project:/git-project \ -v /PATH/TO/SSHDIR:/root/.ssh \ --entrypoint /bin/bash \ binfalse/git-pull
进入容器后执行:
bashssh-keygen -b 4096
所有提示直接回车(不设置密码短语)
3. 配置仓库访问权限
将生成的公钥(/PATH/TO/SSHDIR/id_rsa.pub)添加到Git仓库的部署密钥中(授予读权限)
4. 确认远程主机指纹
在容器中执行git pull,首次连接时接受远程主机指纹(自动保存到known_hosts)
5. 运行拉取命令
配置完成后,使用以下命令拉取SSH仓库更新:
bashdocker run --rm \ -v /path/to/local/project:/git-project \ -v /PATH/TO/SSHDIR:/root/.ssh \ binfalse/git-pull
Docker Image for a Docker:Git-Pull. Copyright (C) 2009-2017 Martin Scharm <[***]> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <[***]>.
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。




探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
不支持 push
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务