【问题标题】:Docker compose build failed when trying to update git submodule from remote repo尝试从远程仓库更新 git 子模块时,Docker compose build 失败
【发布时间】:2022-10-25 17:50:44
【问题描述】:

我需要 docker compose (v2.5.0) 和 git 子模块方面的帮助。这是一个有许多使用 JS 的微服务的大项目。一些微服务内部有 git 子模块(同一个)。我创建了构建整个项目的 docker-compose.yml。当我将构建上下文指向本地目录时效果很好,例如:

some-service:
 build:
  context: /my/home/dir/some-service_dir

但是当我尝试从远程 git repo 构建时

some-service:
 build:
  context: https://gitURL/some-service.git#branch

并且该服务内部有子模块,当尝试执行git submodule update 时,它会以fatal: not a git repository (or any of the parent directories): .git 崩溃。我尝试在 docker 文件和 makefile 中交替指定适当的指令。 该服务具有正确结构的 .gitsubmodule 文件,例如

[submodule "name"]
    path = submoduleDir
    url = https://git.repo.url/mysubmodule.git
    branch = develop

我想,.git 中的所有配置也是正确的,因为它在其他情况下效果很好。 所以我不知道发生了什么以及为什么它只在上下文指向远程 git repo 时才起作用。有什么建议么?

【问题讨论】:

    标签: git docker docker-compose git-submodules


    【解决方案1】:

    我也遇到了类似的问题,请问您找到解决方法了吗?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-02
      • 1970-01-01
      • 1970-01-01
      • 2017-02-11
      相关资源
      最近更新 更多