从自定义git回购构建

从自定义git回购构建,git,ssh,docker-compose,Git,Ssh,Docker Compose,docker构建git@some.url.de:/path/to/repo.git起作用,但此组合文件: services: servicea: build: git@some.url.de:/path/to/repo.git 屈服 ERROR: error fetching: Host key verification failed. fatal: Could not read from remote repository. Please make sure you have

docker构建git@some.url.de:/path/to/repo.git
起作用,但此组合文件:

services: 
  servicea:
    build: git@some.url.de:/path/to/repo.git
屈服

ERROR: error fetching: Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
: exit status 128

Git使用ssh访问远程repo。我从cli工作,但不使用compose,这里有什么问题?

您可以将GIT_SSH_命令设置为SSH-v

export GIT_SSH_COMMAND='ssh -v'
这样,您将看到这两个命令之间的差异(
docker build
docker compose build
)。
通常,确保它们由相同的帐户执行(以便从相同的
~/.ssh/已知主机中获益)