build from custom git repo

Viewed 37

docker build git@some.url.de:/path/to/repo.git works, but this compose file:

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

yields

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 uses ssh to access the remote repo. I works from the cli, but not with compose, what's the catch here?

1 Answers

You can set GIT_SSH_COMMAND to ssh -v

export GIT_SSH_COMMAND='ssh -v'

That way, you will see the difference between the two commands (docker build and docker-compose build).
Typically, make sure they are executed by the same account (in order to benefit from the same ~/.ssh/known-hosts)

Related