# Could not instantiate \`CUDA\` in container

**URL:** https://discourse.julialang.org/t/could-not-instantiate-cuda-in-container/136964
**Category:** General Usage
**Tags:** cuda, docker
**Created:** [May 3, 2026, 12:14am UTC](https://discourse.julialang.org/t/could-not-instantiate-cuda-in-container/136964 "2026-05-03T00:14:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Chrysoberyl](https://avatars.discourse-cdn.com/v4/letter/c/ed655f/32.png) [@Chrysoberyl](https://discourse.julialang.org/u/Chrysoberyl)
#### Post date: [May 3, 2026, 12:14am UTC](https://discourse.julialang.org/t/could-not-instantiate-cuda-in-container/136964/1 "2026-05-03T00:14:17Z")

</div>

I have a project manifest for Julia 1.12.4 containing

```toml
[[deps.CUDA]]
deps = ["AbstractFFTs", "Adapt", "BFloat16s", "CEnum", "CUDA_Compiler_jll", "CUDA_Driver_jll", "CUDA_Runtime_Discovery", "CUDA_Runtime_jll", "Crayons", "ExprTools", "GPUArrays", "GPUCompiler", "GPUToolbox", "KernelAbstractions", "LLVM", "LLVMLoopInfo", "LazyArtifacts", "Libdl", "LinearAlgebra", "Logging", "NVTX", "Preferences", "PrettyTables", "Printf", "Random", "Random123", "RandomNumbers", "Reexport", "SparseArrays", "StaticArrays", "Statistics", "demumble_jll"]
git-tree-sha1 = "b267c611dcbbcb70d42e398192ee0af160358075"
uuid = "052768ef-5323-5732-b1bb-66c8b64840ba"
version = "5.11.1"

[[deps.CUDA_Driver_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "TOML"]
git-tree-sha1 = "3b759ec65ac87ad192c2925114fa5c126657a5bd"
uuid = "4ee394cb-3365-5eb0-8335-949819d2adfc"
version = "13.2.1+0"

```

but when I ran `Pkg.instantiate()`, I got

```julia-auto
julia> err
PkgPrecompileError: The following 15 direct dependencies failed to precompile:

GNNGraphsCUDAExt

Failed to precompile GNNGraphsCUDAExt [442ef2ed-951b-5883-8167-ab260819d592] to "/data/.julia/compiled/v1.12/GNNGraphsCUDAExt/jl_aTiJfF".
ERROR: LoadError: InitError: Artifact "CUDA_Driver" was not found by looking in the path "/data/.julia/artifacts/bd9b06cde38a3f0a8392b8924e96cf00546eab55". Try `using Pkg; Pkg.instantiate()` to
 re-install all missing resources if the artifact is part of a package or call `Pkg.ensure_artifact_installed` (https://pkgdocs.julialang.org/v1/api/#Pkg.Artifacts.ensure_artifact_installed) if
 not.
Stacktrace:
 [1] macro expansion
   @ ~/nix/store/0sxag7rwnwbrl3b6qiq4jpik6g7d4l0w-julia/share/julia/stdlib/v1.12/Artifacts/src/Artifacts.jl:732 [inlined]
 [2] find_artifact_dir()
   @ CUDA_Driver_jll ~/nix/store/s3d6b4wfvzyrbk6nkp64k1gp327m7cpj-trexp-cuda-load-path/JLLWrappers/src/wrapper_generators.jl:13
 [3] __init__ ()
   @ CUDA_Driver_jll ~/nix/store/s3d6b4wfvzyrbk6nkp64k1gp327m7cpj-trexp-cuda-load-path/CUDA_Driver_jll/src/wrappers/x86_64-linux-gnu.jl:13
 [4] top-level scope
   @ ~/nix/store/s3d6b4wfvzyrbk6nkp64k1gp327m7cpj-trexp-cuda-load-path/CUDA/src/CUDA.jl:25
 [5] top-level scope
   @ stdin:5

```

How can I solve this problem?

---

<div class="post-metadata">

### Author: ![Wen-Wei\_Tseng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wen-wei_tseng/32/28839_2.png) [@Wen-Wei\_Tseng](https://discourse.julialang.org/u/Wen-Wei_Tseng)
#### Post date: [May 3, 2026, 4:36am UTC](https://discourse.julialang.org/t/could-not-instantiate-cuda-in-container/136964/2 "2026-05-03T04:36:47Z")

</div>

Since it’s running from a container (I assume it’s docker), does the following commands work?

```sh
nvidia-smi

```

```sh
sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi

```

The NVIDIA container toolkit is required for CUDA to work inside containers.

Source: [Installing the NVIDIA Container Toolkit — NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)

---

<div class="post-metadata">

### Author: ![Chrysoberyl](https://avatars.discourse-cdn.com/v4/letter/c/ed655f/32.png) [@Chrysoberyl](https://discourse.julialang.org/u/Chrysoberyl)
#### Post date: [May 3, 2026, 7:07pm UTC](https://discourse.julialang.org/t/could-not-instantiate-cuda-in-container/136964/3 "2026-05-03T19:07:33Z")

</div>

I launched the container using `--runtime=nvidia --gpus all` and `nvidia-smi` correctly shows the host GPU device inside the container.
