Docker build git-url-using-ssh fails to find context

Hi All,

I’m using docker community, engine version 19.03.5, build 633a0ea838

I am setting up a CI server to perform docker builds using remote git repositories via SSH

I am attempting to use the synatx: sudo docker build remote-git-SSH-URL

Each of the following commands results in the error 'unable to prepare context: “the command below” not found’

  • sudo docker build ssh://myuser@my-host.mydomain/project/myrepo
  • sudo docker build myuser@my-host.mydomain:project/myrepo
  • sudo docker build myuser@my-host.mydomain:/project/myrepo

The git repo has been configured with both basic auth over HTTPS and also for SSH with the developer SSH keys

The following git SSH clone commands work in the environment:

  • git clone ssh://myuser@my-host.mydomain/project/myrepo
  • git clone myuser@my-host.mydomain:project/myrepo
  • git clone myuser@my-host.mydomain:/project/myrepo

This indicates to me that both the URL path used and the SSH configuration are setup correctly.

Additionally I can manually perform a docker build over HTTPS successfully using this command:
sudo docker build https://my-host.mydomain/project/myrepo.git

This indicates to me the issue is not to do with the repository but the way docker parses the path I am using above for SSH

Please can anyone advise me if I am simply using incorrect syntax or whether they think this might be a bug in docker?

Best wishes to all…
Nath