Skip to content

Commit f91434e

Browse files
authored
Make the Nix-based Docker container work on non-NixOS (#3109)
On NixOS, the CUDA driver shim gets mounted on /run/opengl-driver, where Nix packages expect the shim to be. However, on other distributions, some FHS paths are mounted. This is a small change to make the dynamic loader find the shim.
1 parent 8b91f92 commit f91434e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

flake.nix

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,15 @@
176176
'';
177177
};
178178

179-
dockerImage = pkgs.callPackage nix/docker.nix {
179+
# Use plain nixpkgs without overlays for dockerTools. dockerTools
180+
# uses a Python package for computing the layers from the transitive
181+
# closure. However, this needs a lot of rebuilds due to our overlay.
182+
183+
dockerImage = nixpkgs.legacyPackages.${system}.callPackage nix/docker.nix {
180184
text-generation-inference = default;
181185
};
182186

183-
dockerImageStreamed = pkgs.callPackage nix/docker.nix {
187+
dockerImageStreamed = nixpkgs.legacyPackages.${system}.callPackage nix/docker.nix {
184188
text-generation-inference = default;
185189
stream = true;
186190
};

nix/docker.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ build {
1818
Env = [
1919
"HF_HOME=/data"
2020
"PORT=80"
21+
# The CUDA container toolkit will mount the driver shim into the
22+
# container. We just have to ensure that the dynamic loader finds
23+
# the libraries.
24+
"LD_LIBRARY_PATH=/usr/lib64"
2125
];
2226

2327
};

0 commit comments

Comments
 (0)