因此,我在本地计算机上使用 docker-compose 在 docker 容器上运行了简单的 hello world .net core 应用程序设置
问题是当我尝试使用 Debug -> Attach to Process -> ConnectionType Docker(Linux Container) -> 选择进程并点击 Attach 从 vs2019 附加调试器时。
我收到错误提示
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).
似乎出于某种原因,视觉工作室尝试将调试器复制到正在运行的容器,但失败了
这是简单的 dockerfile 和 docker-compose 脚本
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
笔记:
- 我已经在docker主机上勾选了共享驱动器
有什么线索吗?