b-data / data-science-devcontainers

(GPU accelerated) Multi-arch (linux/amd64, linux/arm64/v8) Data Science dev containers for R, Python, Julia and Mojo
MIT License
22 stars 9 forks source link

Does it work with Podman? #1

Closed benz0li closed 1 year ago

benz0li commented 1 year ago

https://podman.io

benz0li commented 1 year ago

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)

benz0li commented 1 year ago

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"
 }
benz0li commented 1 year ago

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/" ]

benz0li commented 1 year ago

Cross references: