Vscode-docker: Docker run fails with "read-only file system"

Created on 20 Jan 2019  路  14Comments  路  Source: microsoft/vscode-docker

Hi,

I'm on Ubuntu 18.10, and I'm trying to run a .NET Core project in VSCode with to Dockerfile being added by running the command `Docker: Add Docker Files to Workspace".

Here's my configuration

    {
      "appProject": "${workspaceFolder}/webapi/webapi.csproj",
      "dockerBuild": {
        "dockerfile": "${workspaceFolder}/Dockerfile"
      },
      "dockerRun": {},
      "name": "Docker: Launch .NET Core (Preview)",
      "preLaunchTask": "build",
      "request": "launch",
      "type": "docker-coreclr"
    },

And, a screenshot of my project structure:
image

And, my (auto-generated) Dockerfile:

FROM microsoft/dotnet:2.2-runtime AS base
WORKDIR /app

FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /src
COPY ["webapi/webapi.csproj", "webapi/"]
RUN dotnet restore webapi/webapi.csproj
COPY . .
WORKDIR /src/webapi
RUN dotnet build "webapi.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "webapi.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "webapi.dll"]

But when I try to start the project, I see this error in my output window:

Error response from daemon: error while creating mount source path 
    '/usr/local/share/dotnet/sdk/NuGetFallbackFolder': mkdir
    /usr/local/share/dotnet: read-only file system.

Am I missing something here?

It may be worth mentioning that on my machine, I can run docker commands without sudo

Thank you.

All 14 comments

@farzadmf What version of Docker is installed? Is it the "snap" (docker-snap) version or the "standard" (docker-ce) version?

@philliphoff I installed it using snap install docker; this is the result of snap list:
image

@farzadmf From the error message, it may be related to the use of the snap version of Docker, which seems to have issues creating volumes that mount outside of the user's home directory. (The Docker extension adds a volume during debugging that mounts to the NuGet package fallback folder on the local machine.)

I'm trying to setup a VM with that same configuration to confirm that; in the meantime, you may have more luck with the "standard" Docker installation.

Thank you @philliphoff for your answer, I did what you suggested, and actually, the "standard" Docker installation seems to have a more recent version.

BUT, now I have a very annoying problem that I don't know how to solve; if you could somehow help me with this, I would really appreciate it.

So, I installed docker using apt, and I'm able to run containers (I had an error is VSCode, but it might be a side effect of this, so I'm trying in "normal" terminal), but when I want to stop the containers, I see this error:

ERROR: for jaeger-rabbit  cannot stop container: 48a62db02cddb7a8e8bf3a3b9cc3401924ed7a58592fe6f28198267e73fa1fb3: 
    Cannot kill container 48a62db02cddb7a8e8bf3a3b9cc3401924ed7a58592fe6f28198267e73fa1fb3: 
    unknown error after kill: runc did not terminate sucessfully: container_linux.go:387: signaling 
    init process caused "permission denied"

Do you have any idea why that's happening? I'd appreciate if you help me

Maybe related to this @farzadmf? The scenario sounds similar (switching from the Ubuntu packaged Docker to the "standard" one).

Also, is your VS Code installed via snap as well?

Thank you @philliphoff for the link. It might have been an issue with groups/users etc. I looked at "Linux post-installation steps" in Docker docs, tried a few commands, restarted a few times, and it seems to be working now.

As for VSCode, it WAS installed using snap, but because of some font issues, I removed it and installed it using the deb package.

And, now that those things are fixed, I tried again with VSCode to run docker, and I get this message:

Starting: "docker" exec -i 0173b9cc2feed5b3ca282044493d986cccf1c37570820168c4f124e8683ac202
    /remote_debugger/vsdbg --interpreter=vscode
OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caused 
    "no such file or directory": unknown

And when I do docker ps, I see this container is running:
image

Any ideas?

@philliphoff Any comment/suggestion on this please?

Hmmm, can you verify that the container has both /app and /remote_debugger folders? These should be volume-mounted into the container from your application build output and the folder in which the debugger bits are cached. I'm not sure what else it would be failing to find, without being able to do more general spelunking into the project, image, and container.

Thank you @philliphoff for your answer, I'll try to find out what's happening

Hi @philliphoff , as it turns out, the reason for that message was that I was using microsoft/dotnet:2.2-aspnetcore-runtime-alpine, and for some reason, the debug doesn't work in the alpine version. Is it expected?

Also, the network option was added in #748 (and #692 is the relevant issue), but it doesn't seem to be available, and when I Ctrl+Space in my launch.json, I still see only 4 options:
image

Is there an ETA when that setting will be available?

Thank you

@farzadmf We expect a new release in about 2 weeks.

@farzadmf Alpine-based images require a different variant of the .NET Core debugger so we'd need some logic to detect which variant is required for a given image. I'll add an issue specifically to add that support (but can't yet answer when that might become available).

Added #765 for Alpine image support.

@StephenWeatherford and @philliphoff thank you both for your help.

I'll close this one as it seems to be resolved :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bradygmsft picture bradygmsft  路  7Comments

yusufkaratoprak picture yusufkaratoprak  路  4Comments

Kludex picture Kludex  路  7Comments

sajayantony picture sajayantony  路  5Comments

Szauka picture Szauka  路  6Comments