docker cant find file in parent folder?

  docker, dockerfile

I have a problem where docker build can’t find my files and I’ve tried many folder references but I cant get my head around the folder structure. No matter what its wrong.

This is my project (slimmed down) structure:

enter image description here

This is my docker file:

# pull official base image
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env

# set working directory
WORKDIR /app

# add app csprojfiles
COPY ./myapi.sln .

and this is the error:

failed to compute cache key: "/myapi.sln" not found: not found

I’ve tried COPY ../myapi.sln . and simply myapi.sln but its not found no matter what. Im running command docker build web.api/ from the parent myapi folder in command prompt.

Source: Docker Questions

LEAVE A COMMENT