Skip to content

Docker run fails with "read-only file system" #749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
farzadmf opened this issue Jan 20, 2019 · 14 comments
Closed

Docker run fails with "read-only file system" #749

farzadmf opened this issue Jan 20, 2019 · 14 comments
Assignees

Comments

@farzadmf
Copy link

farzadmf commented Jan 20, 2019

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.

@philliphoff
Copy link
Member

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

@farzadmf
Copy link
Author

farzadmf commented Jan 22, 2019

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

@philliphoff
Copy link
Member

@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.

@farzadmf
Copy link
Author

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

@philliphoff
Copy link
Member

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?

@farzadmf
Copy link
Author

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?

@farzadmf
Copy link
Author

@philliphoff Any comment/suggestion on this please?

@philliphoff
Copy link
Member

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.

@farzadmf
Copy link
Author

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

@farzadmf
Copy link
Author

farzadmf commented Jan 29, 2019

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

@StephenWeatherford
Copy link
Contributor

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

@philliphoff
Copy link
Member

@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).

@philliphoff
Copy link
Member

Added #765 for Alpine image support.

@farzadmf
Copy link
Author

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

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

@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants