b-data/data-science-devcontainers

Does it work with Podman?

benz0li opened this issue · 4 comments

Yes.

However, certain tricks like Docker-from-Docker do not work due to limitations in Podman. This affects the Dev Containers: Try a Dev Container Sample... and Dev Containers: Clone Repository in Container Volume... commands.

Dev Containers Docker options (2023-06-26)

You must disable feature docker-outside-of-docker and are supposed to run the Dev Container as root. E.g. modify the devcontainer.json for Julia base as follows:

diff --git a/.devcontainer/julia-base/devcontainer.json b/.devcontainer/julia-base/devcontainer.json
index fe18c76..85c8410 100644
--- a/.devcontainer/julia-base/devcontainer.json
+++ b/.devcontainer/julia-base/devcontainer.json
@@ -28,9 +28,6 @@
 			"username": "vscode",
 			"userUid": "automatic",
 			"userGid": "automatic"
-		},
-		"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
-			"moby": false
 		}
 	},
 
@@ -52,8 +49,7 @@
 				"julialang.language-julia",
 				"dbaeumer.vscode-eslint",
 				"esbenp.prettier-vscode",
-				"ms-python.black-formatter",
-				"ms-azuretools.vscode-docker"
+				"ms-python.black-formatter"
 			],
 			"settings": {
 				"gitlens.graph.statusBar.enabled": false,
@@ -78,14 +74,8 @@
 		}
 	},
 
-	// Set 'remoteUser' to 'root' to connect as root instead.
-	"remoteUser": "vscode",
-	"workspaceMount": "source=julia-base-home-vscode,target=/home/vscode,type=volume",
-	// "workspaceMount": "source=${localWorkspaceFolder}/.bind-mounts/julia-base-home-vscode,target=/home/vscode,type=bind",
-	"workspaceFolder": "/home/vscode"
-
-	// "remoteUser": "root",
-	// "workspaceMount": "source=julia-base-root,target=/root,type=volume",
-	// // "workspaceMount": "source=${localWorkspaceFolder}/.bind-mounts/julia-base-root,target=/root,type=bind",
-	// "workspaceFolder": "/root"
+	"remoteUser": "root",
+	"workspaceMount": "source=julia-base-root,target=/root,type=volume",
+	// "workspaceMount": "source=${localWorkspaceFolder}/.bind-mounts/julia-base-root,target=/root,type=bind",
+	"workspaceFolder": "/root"
 }

NVIDIA Container Toolkit: Should you not use the Container Device Interface (CDI), ensure that the hook has been added and that you changed the NVIDIA runtime configuration.

For CUDA-enabled versions, you also need to modify the runArgs. E.g. modify the devcontainer.json for CUDA Julia base as follows:

diff --git a/.devcontainer/cuda-julia-base/devcontainer.json b/.devcontainer/cuda-julia-base/devcontainer.json
index ac01b36..e43f1d8 100644
--- a/.devcontainer/cuda-julia-base/devcontainer.json
+++ b/.devcontainer/cuda-julia-base/devcontainer.json
@@ -28,9 +28,6 @@
                        "username": "vscode",
                        "userUid": "automatic",
                        "userGid": "automatic"
-               },
-               "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
-                       "moby": false
                }
        },
 
@@ -52,8 +49,7 @@
                                "julialang.language-julia",
                                "dbaeumer.vscode-eslint",
                                "esbenp.prettier-vscode",
-                               "ms-python.black-formatter",
-                               "ms-azuretools.vscode-docker"
+                               "ms-python.black-formatter"
                        ],
                        "settings": {
                                "gitlens.graph.statusBar.enabled": false,
@@ -79,15 +75,10 @@
        },
 
        // Set 'remoteUser' to 'root' to connect as root instead.
-       "remoteUser": "vscode",
-       "workspaceMount": "source=cuda-julia-base-home-vscode,target=/home/vscode,type=volume",
-       // "workspaceMount": "source=${localWorkspaceFolder}/.bind-mounts/cuda-julia-base-home-vscode,target=/home/vscode,type=bind",
-       "workspaceFolder": "/home/vscode",
+       "remoteUser": "root",
+       "workspaceMount": "source=cuda-julia-base-root,target=/root,type=volume",
+       // "workspaceMount": "source=${localWorkspaceFolder}/.bind-mounts/cuda-julia-base-root,target=/root,type=bind",
+       "workspaceFolder": "/root",
 
-       // "remoteUser": "root",
-       // "workspaceMount": "source=cuda-julia-base-root,target=/root,type=volume",
-       // // "workspaceMount": "source=${localWorkspaceFolder}/.bind-mounts/cuda-julia-base-root,target=/root,type=bind",
-       // "workspaceFolder": "/root",
-
-       "runArgs": [ "--gpus=all" ]
+       "runArgs": [ "--device", "nvidia.com/gpu=all" ]
 }

👉 Should you not use the CDI: "runArgs": [ "--hooks-dir=/usr/share/containers/oci/hooks.d/" ]