简体   繁体   中英

Docker Compose: cannot run ssh: No such file or directory

I'm trying to use docker-compose to fetch, build and run multiple services from their git repositories. I made a simple docker-compose.yml to test it:

version: '3'

services:
  test-service:
    build: git@gitlab.com:dan-poltherm/partservicego.git
    ports:
      - 8005:443

It seems that docker-compose can't fetch repository I get following error when calling docker-compose up --build :

ERROR: error fetching: fatal: cannot run ssh: No such file or directory

I have OpenSSH Client installed (Windows 10 port) and %SYSTEMROOT%\\System32\\OpenSSH\\ added to PATH, I also set GIT_SSH to C:\\Windows\\System32\\OpenSSH\\ssh.exe . I can clone repo with git clone and ssh also works from powershell.

个人访问令牌是一种方法

As far as i know, "build:" is the path where your Dockerfile is located.

I would suggest to checkout the repository, and put the docker-compose.yml inside the folder.

Then change your docker-compose.yml to:

version: '3'

services:
  test-service:
    build: .
    ports:
      - 8005:443

From the docs ( https://docs.docker.com/compose/compose-file/ ):

build can be specified either as a string containing a path to the build context:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM