sleemer / docker.dotnet.debug

This is a sample that demonstrates how to debug dotnet core 2.0 console running in docker from vscode
73 stars 14 forks source link

No such container error #1

Closed mayconbeserra closed 6 years ago

mayconbeserra commented 7 years ago

Hi, thanks for sharing your config, but unfortunately it isn't working properly with the latest version of VSCode.

I tried to apply to my project and it didn't work, and then I decided to use your git sample but I still getting the same error:

Starting: "docker" exec -i docker.dotnet.debug_1 /vsdbg/vsdbg --interpreter=vscode Error from pipe program 'docker': Error: No such container: docker.dotnet.debug_1

Could you highlight how can I solve this issue? have you tested with the latest version of VSCode?

Best regards, M

sleemer commented 7 years ago

Hi, hard to say what exactly went wrong without more detailed logs. Could you provide me them? Here is mine: Killing all containers based on the docker.dotnet.debug image de7c2be8df94 Building the image docker.dotnet.debug (debug). Sending build context to Docker daemon 6.144kB

Step 1/11 : FROM microsoft/dotnet:2-sdk ---> 49cbdf4b5430 Step 2/11 : ENV NUGET_XMLDOC_MODE skip ---> Using cache ---> f4e45b5012ae Step 3/11 : WORKDIR /vsdbg ---> Using cache ---> d935f788d515 Step 4/11 : RUN apt-get update && apt-get install -y --no-install-recommends unzip && rm -rf /var/lib/apt/lists/* && curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l /vsdbg ---> Using cache ---> d7b761bab60f Step 5/11 : RUN mkdir /app ---> Using cache ---> 8ce184134b06 Step 6/11 : WORKDIR /app ---> Using cache ---> fa5b8633e27a Step 7/11 : COPY App.csproj /app ---> Using cache ---> c4cc0f99affc Step 8/11 : RUN dotnet restore ---> Using cache ---> 9045dc6df58f Step 9/11 : COPY . /app ---> Using cache ---> 4dc92586b9ad Step 10/11 : RUN dotnet publish -c Debug -o out ---> Using cache ---> f179ef75d4df Step 11/11 : ENTRYPOINT ["/bin/bash", "-c", "sleep infinity"] ---> Using cache ---> 209c069130d0 Successfully built 209c069130d0 Successfully tagged docker.dotnet.debug:latest Running a new container docker.dotnet.debug_1 d2379ead77e760312083243ca25c9b2992252c42d05a8d71324ec968b222bd89

d-saurabh commented 6 years ago

Can you please post the build and run command for the container. Also suggest the steps to follow for attaching the debugger in local machine's vs code.

sleemer commented 6 years ago

Hi @saurabhdeshpande49! You can find build and run commands in /scripts/dockerTask.sh file. And if you want to attach to existing app running inside the docker container you will need to add a new configuration in launch.json

{
            "name": ".NET Core Docker Attach (console)",
            "type": "coreclr",
            "request": "attach",
            "processName": "dotnet",
            "sourceFileMap": {
                "/app": "${workspaceRoot}/src"
            },
            "pipeTransport": {
                "pipeProgram": "docker",
                "pipeCwd": "${workspaceRoot}",
                "pipeArgs": [
                    "exec -i docker.dotnet.debug_1"
                ],
                "quoteArgs": false,
                "debuggerPath": "/vsdbg/vsdbg"
            }
        }

Be aware, that you need to replace 'docker.dotnet.debug_1' with the name of your container. Key things worth to mention: