运行 docker 时 vsdbg 上的权限问题.exe - exec: \"/app/vsdbg\: 权限被拒绝



我的目标是使用 vsdbg 调试 Docker 容器。此容器包含一个 ASP.NET 核心 API 应用程序。

为此,我使用 Docker 文件创建了一个 Docker 映像,然后运行了该容器。

为了开始远程调试,我使用了以下命令:

docker exec -i  a05a0439540b  "/app/vsdbg"

然后我收到以下错误消息:

OCI 运行时执行失败:执行失败:container_linux.go:344:启动容器进程导致"exec:"/app/vsdbg":权限被拒绝":未知

请在下面找到 Docker 文件内容:

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
EXPOSE 80
#EXPOSE 443
#RUN Invoke-WebRequest -OutFile c:vs_remotetools.exe -Uri
http://download.microsoft.com/download/1/2/2/1225c23d-3599-48c9-a314-f7d631f43241/vs_remotetools.exe;
#RUN & 'c:rtools_setup_x64.exe' /install /quiet
#RUN  & 'c:vs_remotetools.exe' /install /quiet
EXPOSE 4024
RUN apt-get update 
    && apt-get install -y --no-install-recommends 
    unzip 
    && curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ./vsdbg 
    && rm -rf /var/lib/apt/lists/*
#RUN chmod 700 -R /app/vsdbg
RUN /bin/bash -c 'ls -la; chmod 777 /app/vsdbg; ls -la'
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src
COPY ["testDockerCore.csproj", ""]
RUN dotnet restore "testDockerCore.csproj"
COPY . .
WORKDIR "/src/"
RUN dotnet build "testDockerCore.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "testDockerCore.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "testDockerCore.dll"]

但我仍然面临同样的错误。

使用以下命令启动 Docker 镜像:

docker run -it -p 4200:4024 testdockercore:dev

如何解决此问题?

我今天遇到了同样的问题 - 错误消息有点令人困惑。/vsdbg 目录上没有执行权限;而不是"/app/vsdbg",你需要阅读 launch.json :

"debuggerPath": "/app/vsdbg/vsdbg",

我在运行chmod 777 -R /root/vsdbg/vsdbg时遇到了同样的问题

对我来说,vsdbg在根文件夹下。

最新更新