3

I'd like to have a section like this in my docker-compose.yml file:

 services:
     thing:
          build: git@server.company.com/path/to/project.git

Then I'd like to build it with docker-compose build thing

But when I try that it fails with

ERROR: error fetching: fatal: 'git@server.company.com/path/to/project.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Presumably it's failing because it needs my ssh keys to access the repository and the docker daemon is running in a linux VM which doesn't have access to my keys.

How can I pass a ssh key, or an ssh agent socket to the docker daemon so it can access a private repository?

Lawrence D'Anna
  • 2,998
  • 2
  • 22
  • 25
  • https://stackoverflow.com/questions/18136389/using-ssh-keys-inside-docker-container This answers your question. – Rushal Verma Jan 23 '18 at 05:38
  • I don't think it does. This is about passing ssh creeds to access the docker file in the first place, not about accessing ssh keys inside a container – Lawrence D'Anna Jan 23 '18 at 19:21

0 Answers0