I am trying to run a docker container using VSCode, but every time I try opening the folder in the container, the container appears to build just fine, but it cannot start.
I get an error docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /run/user/1000/wayland-0
There’s a lot more after that error too, but as far as I can tell, that’s the first one.
I can run docker run hello-world
in the terminal and I get the correct little welcome message from docker. Similarly, docker run -it ubuntu bash
works just fine in the terminal. But when I try to use docker containers from docker files in VSCode, I get the error.
What I have tried
A system administrator at my college was helping me troubleshoot, which means that I may not understand every last detail of what we tried.
First, we thought it might be SELinux. We switched SELinux to permissive mode and tried rebuilding the container, but we still had the error. We tried checking the end of the SELinux logs, but we couldn’t find anything that pointed to the problem.
Then, we thought it might be firewalld, but temporarily disabling it also didn’t get rid of the problem.
On my own, I found this GitHub issue on VSCode Remote Release: Support SELinux enabled systems · Issue #1333 · microsoft/vscode-remote-release · GitHub
From this, I tried changing the top of my devcontainer.json file to
{
"build": {
"dockerfile": "Dockerfile"
},
"workspaceMount": "",
"runArgs": ["--volume=${localWorkspaceFolder}:/workspaces/${localWorkspaceFolderBasename}:Z",
"--shm-size=2gb" // std 64mb (!) are not enough],
],
which also resulted in the same error.
Where should I go from here? My goal is to be able to build and open a docker container in VSCode based on a dockerfile and devcontainer.json provided by my professor. I saw Moby and Podman mentioned as different kinds of alternatives to Docker. Would either of them help in my case? Why would I choose to use one of them instead of Docker?
Details about my system and docker files
Fedora 39 KDE spin
latest version of Docker Desktop ( Docker version 26.0.0, build 2ae903e)
latest version of VSCode (not a flatpak) (1.87.2)
The docker file is
FROM ubuntu:latest
RUN apt-get -y update
RUN apt-get -y install git
The devcontainer.json file is
{
"build": {
"dockerfile": "Dockerfile"
},
"runArgs": [
"--shm-size=2gb" // std 64mb (!) are not enough
],
"settings": {
"terminal.integrated.profiles.linux": {
"bash (login)": {
"path": "/bin/bash",
"args": [
"-li"
]
}
},
"terminal.integrated.defaultProfile.linux": "bash (login)"
},
"extensions": [
"donjayamanne.git-extension-pack",
"mhutchie.git-graph",
"ms-python.python",
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"ms-vscode.cpptools-themes"
]
}