问题
My object is to debug the docker container using vsdbg , this container contains asp.net core api application. To do this, created docker image using docker file, and then run the container. And to start remote debugging , used below command:
docker exec -i a05a0439540b "/app/vsdbg"
then got below error message:
OCI runtime exec failed: exec failed: container_linux.go:344: starting
container process caused "exec: \"/app/vsdbg\": permission denied": unknown
please find below docker file content:
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"]
but still facing same error.
using below command to start docker image:
docker run -it -p 4200:4024 testdockercore:dev
can you please help me out to resolve this problem.
回答1:
I ran into this same issue today - the error message is a little confusing. There are no execute permissions on the /vsdbg directory; instead of "/app/vsdbg" you're launch.json needs to read:
"debuggerPath": "/app/vsdbg/vsdbg",
回答2:
Have the same issue running chmod 777 -R /root/vsdbg/vsdbg
for me the vsdbg is under root folder
来源:https://stackoverflow.com/questions/57134729/permission-issue-on-vsdbg-while-running-docker-exe-exec-app-vsdbg-permis