【发布时间】:2019-07-21 15:48:50
【问题描述】:
我的目标是使用vsdbg 调试 Docker 容器。此容器包含一个 ASP.NET Core 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
我该如何解决这个问题?
【问题讨论】:
标签: c# docker asp.net-core dockerfile