How to pass the right context to docker-compose build?

Viewed 546

I have the following docker-compose file:

version: "3.9"

services:
  repo_svc:
    build:
      context: ../
      dockerfile: ../build/Dockerfile

Running the command, I have got the following error message:

docker-compose -f ./deployments/docker-compose.yml build
Building repo_svc
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/developer/versioner/services/build: no such file or directory
ERROR: Service 'repo_svc' failed to build : Build failed

The folder structure of GO project:

enter image description here

I would like to pass to context: ../ the repo-svc folder context. However, I do not know why it is looking in the /home/developer/versioner/services/build folder. It even does not exist.

1 Answers

I think the context should look like:

version: "3.9"

    services:
      repo_svc:
        build:
          context: ../build
          dockerfile: Dockerfile
Related