0

The Dockerfile COPY command is not actually copying a file into a container's file system when it was run via Visual Studio 'Docker Compose' start button (with or without debugging). Dockerfile excerpt:

FROM base AS final
WORKDIR /app
COPY ["src/My.UserProfile.Api/test.txt", "/usr/local/bin/"]

After I ran 'Docker Compose' from Visual Studio I inspected the container's file system in order to find a file that was supposed to be copied into (test.txt) - but it was missing.

So I've observed the docker-compose up command logged in my Output window, and tried to run it from command prompt instead of from Visual Studio.

That gave the same result - the file was still missing.

However, when I remove reference to docker-compose.vs.debug.g.yml everything works as expected.

Any idea why would -f "C:\dev\source\repos\userprofile-service\obj\Docker\docker-compose.vs.debug.g.yml" cause these issues?

version: '3.4'
services:
  my.userprofile.api:
image: myuserprofileapi:dev
container_name: My.UserProfile.Api_1
build:
  target: base
  labels:
    com.microsoft.created-by: "visual-studio"
    com.microsoft.visual-studio.project-name: "My.UserProfile.Api"
environment:
  - DOTNET_USE_POLLING_FILE_WATCHER=1
  - ASPNETCORE_LOGGING__CONSOLE__DISABLECOLORS=true
  - NUGET_FALLBACK_PACKAGES=/root/.nuget/fallbackpackages
volumes:
  - C:\dev\source\repos\userprofile-service\src\My.UserProfile.Api:/app
  - C:\dev\source\repos\userprofile-service:/src
  - C:\Users\jdoe\vsdbg\vs2017u5:/remote_debugger:rw
  - C:\Users\jdoe\.nuget\packages\:/root/.nuget/packages:ro
  - C:\Program Files\dotnet\sdk\NuGetFallbackFolder:/root/.nuget/fallbackpackages:ro
  - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
  - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro

entrypoint: tail -f /dev/null
labels:
  com.microsoft.visualstudio.debuggee.program: "dotnet"
  com.microsoft.visualstudio.debuggee.arguments: " --additionalProbingPath /root/.nuget/packages --additionalProbingPath /root/.nuget/fallbackpackages  \"/app/bin/Debug/net6.0/My.UserProfile.Api.dll\""
  com.microsoft.visualstudio.debuggee.workingdirectory: "/app"
  com.microsoft.visualstudio.debuggee.killprogram: "/bin/sh -c \"if PID=$$(pidof dotnet); then kill $$PID; fi\""
tty: true

0 Answers0