3

Inside my docker-compose.yml I'm using ssh address context to build a Docker image.

ui:
    build:
      context: git@my.git.host:ui/ui.git
      dockerfile: Dockerfile.prod
    container_name: ui
    ports:
      - "4200:4200"
    command: ember serve

Running docker-compose build ui gives me :

compose.cli.verbose_proxy.proxy_callable: docker build -> <generator object APIClient._stream_helper at 0x7faa8bc107d8>
ERROR: compose.cli.errors.log_api_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.

If I build the image using docker build it works normally

docker build git@my.git.host:ui/ui.git -f Dockerfile.prod

My context

compose.cli.command.get_client: docker-compose version 1.21.0, build unknown
docker-py version: 4.0.1
CPython version: 3.6.7
OpenSSL version: OpenSSL 1.1.1  11 Sep 2018

LATER EDIT:
I managed to reproduce the issue using the docker pip

import docker
client = docker.APIClient()
log = client.build(path="git@my.git.host:ui/ui.git", dockerfile="Dockerfile.prod")
for chunk in log:
  print(loc)

Output:

docker.errors.APIError: 500 Server Error: Internal Server 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")
Dorin
  • 2,482
  • 2
  • 22
  • 38
  • 4
    I wish people wouldn't downvote questions without explaining why. So frustrating! Anyway, this is a known issue with docker-composer documented [here](https://github.com/docker/compose/issues/2856) – David Jun 10 '19 at 20:21
  • 1
    Found another open issue that details some more possible workarounds [here](https://github.com/docker/compose/issues/3038) – David Jun 10 '19 at 20:37
  • I've been successfully using the [workaround] (https://github.com/docker/compose/issues/3038) and inserted credentials in the url `https://username:token@my.git.host/username/repo.git` – Dorin Jun 11 '19 at 08:44

0 Answers0