Failed attaching debugger to local docker linux container from visual studio 2019

0

So I have simple hello world .net core application setup on my local machine running on docker container using docker-compose

The problem is when I tried to attach debugger from vs2019 using Debug -> Attach to Process -> ConnectionType Docker(Linux Container) -> select the process and hit attach.

I got error stated

Failed to launch debug adapter 'coreclr'.
Failed to copy files.


Initialization log:
Determining user folder on remote system...
Checking for existing installation of debugging tools...
Downloading debugger launcher...
Creating debugger installation folder: /root/.vs-debugger
Copying debugger launcher to /root/.vs-debugger/GetVsDbg.sh
Failed: Failed to copy files.
The program '[360] bash' has exited with code -1 (0xffffffff).

It seems for some reason the visual studio tried to copy the debugger to the running container but failed

here's the simple dockerfile and docker-compose script

Dockerfile

FROM microsoft/aspnetcore-build:1.1.2

RUN apt-get update && apt-get install -y unzip

RUN curl -sSL \
   https://aka.ms/getvsdbgsh | bash /dev/stdin -v vs2019 -l /root/.vs-debugger

COPY node_modules/wait-for-it.sh/bin/wait-for-it /tools/wait-for-it.sh

RUN chmod +x /tools/wait-for-it.sh

ENV DBHOST=dev_mysql WAITHOST=dev_mysql WAITPORT=3306

ENV DOTNET_USE_POLLING_FILE_WATCHER=true 

EXPOSE 80/tcp

VOLUME /app

WORKDIR /app

ENTRYPOINT dotnet restore \
    && /tools/wait-for-it.sh $WAITHOST:$WAITPORT --timeout=0 \
       && dotnet watch run --environment=Development

docker-compose.yml

version: "3"

volumes:
  productdata:

networks:
  backend:

services:
  mysql:
    image: "mysql:8.0.0"
    volumes:
      - productdata:/var/lib/mysql
    networks:
      - backend
    environment:
      - MYSQL_ROOT_PASSWORD=mysecret
      - bind-address=0.0.0.0

  mvc:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - .:/app
      - /app/obj
      - /app/bin
      - ~/.nuget:/root/.nuget
      - /root/.nuget/packages/.tools
    ports:
      - 3000:80
    networks:
      - backend
    environment:
      - DBHOST=mysql
      - WAITHOST=mysql
    depends_on:
      - mysql

Note: - I have already tick the Shared Drive on the docker host

any clue about this?

docker
asp.net-core
docker-compose
asked on Stack Overflow Feb 28, 2020 by Ariya Binui

1 Answer

0

It seems for some reason visual studio didn't have access to the docker-users group in spite I already add my current user account to the group

The workaround is to create new windows user and add it to the docker-users group. It works like a charm

answered on Stack Overflow Mar 3, 2020 by Ariya Binui

User contributions licensed under CC BY-SA 3.0