如何解决docker-compose 不能使用 git 子模块
我尝试使用 docker-compose 从 git 构建一个 docker 容器,但是当我尝试执行“docker-compose build”时,它说:
Building network_monitor
ERROR: error initializing submodules: git: 'submodule' is not a git command. See 'git --help'.
: exit status 1
我的 docker-compose.yml:
version: "3"
services:
[...(irrelevant services)...]
network_monitor:
build: git://github.com/Kruemmelspalter/network_monitor#main
ports:
- "10380:80"
volumes:
- "./network_monitor/conf:/root/conf"
[...(irrelevant services)...]
解决方法
我将首先测试相同的构建,使用 HTTPS URL,而不是 git://
,使用 build context(在 Dockerfile v2 中)
build:
context: github.com/Kruemmelspalter/network_monitor#main
dockerfile: Dockerfile
或者干脆:
build: github.com/Kruemmelspalter/network_monitor#main
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。