0

i have a command line arguments accepting console application whose code i have to execute in docker. Now, the console application code uses directory which is one level behind my console application directory,so for that i have made a docker file which would copy current directory content as well as the content of whole directory one level behind ("../."). But when i do docker run i get error saying directory does not exist from my console application side. Can anyone help me out with this? is there any other way to include whole directory with subfiles and subdirectory?

Docker file code:

` FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env

WORKDIR /app

COPY . /app

copy ../ /app

RUN dotnet restore

RUN dotnet build -c Release

RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:5.0

WORKDIR /app

COPY --from=build-env /app/out .

ENTRYPOINT ["dotnet", "ConsoleApp3.dll","localhost","","root","","nocodeproductdb","","","NoCodeAppAPI","YES","3306","amqp://guest:guest@127.0.0.1/","ReactTs","DotNet"] `

Ansh Shah
  • 3
  • 2
  • You need to pass the parent directory as the `docker build` directory argument, and make the left-hand side of `COPY` relative to that directory. You can never `COPY ../...` from a parent or sibling directory of the build-context directory. – David Maze Jan 29 '23 at 12:11
  • I changed the code but still get same error of directory does not exist, i had put Console.Writeline in my c# code to see the directories of docker this time as i was not able to see them on docker cli due to error and it does not have any directory present on my machine, it just has /app/runtimes directory and some dll files – Ansh Shah Jan 29 '23 at 12:55

0 Answers0