TutorialsGB10

Run an NVIDIA NIM on a DGX Spark

One container that holds a model already tuned for the machine: sign in to NVIDIA’s registry, choose a NIM, start it, test it, and keep its model on the disk.

Time
15 to 30 minutes
For
A developer or an IT lead with a DGX Spark
Status
NVIDIA’s public guide · not yet run by AI Deskside

What you will have

  • An NVIDIA NIM running on the Spark: one container that holds a model, already tuned for the machine.
  • An OpenAI-compatible address on port 8000.
  • A model cache on the disk, so the next start does not download again.

What you need

  • A DGX Spark with its drivers: nvidia-smi must answer.
  • Docker with the NVIDIA Container Toolkit.
  • A free NVIDIA NGC account and its API key. NIM containers are downloaded from NVIDIA’s registry with it.
  • Free disk space for the model: typically 10 to 50 GB.
On this page
  1. What a NIM is
  2. 1Check the machine
  3. 2Sign in to NVIDIA’s registry
  4. 3Choose the NIM and prepare its cache
  5. 4Start it
  6. 5Check that it answers
  7. Stop and remove
  8. When something fails
  9. Before production
  10. Managed option
  11. Sources
  12. Fact sheet

What a NIM is

A NIM is a container NVIDIA prepares for one model: the model server, its settings for the machine, and a start that waits until the model is ready. You choose a NIM, not a server and a model separately. Understand Tech’s office boxes serve their models this way.

Step 1

Check the machine

Command
nvidia-smi
docker --version
docker run --rm --gpus all nvcr.io/nvidia/cuda:13.0.1-devel-ubuntu24.04 nvidia-smi

If Docker refuses for lack of permission:

Command
sudo usermod -aG docker $USER
newgrp docker

Step 2

Sign in to NVIDIA’s registry

Command
export NGC_API_KEY="<YOUR_NGC_API_KEY>"
echo "$NGC_API_KEY" | docker login nvcr.io --username '$oauthtoken' --password-stdin

The user name is the literal text $oauthtoken, in single quotes. The key is the password.

Step 3

Choose the NIM and prepare its cache

The guide uses Llama 3.1 8B. NVIDIA’s catalogue lists the other NIMs built for the Spark.

Command
export CONTAINER_NAME="nim-llm-demo"
export IMG_NAME="nvcr.io/nim/meta/llama-3.1-8b-instruct-dgx-spark:latest"
export LOCAL_NIM_CACHE=~/.cache/nim
export LOCAL_NIM_WORKSPACE=~/.local/share/nim/workspace
mkdir -p "$LOCAL_NIM_WORKSPACE"
chmod -R a+w "$LOCAL_NIM_WORKSPACE"
mkdir -p "$LOCAL_NIM_CACHE"
chmod -R a+w "$LOCAL_NIM_CACHE"

Step 4

Start it

Command
docker run -it --rm --name=$CONTAINER_NAME \
  --gpus all \
  --shm-size=16GB \
  -e NGC_API_KEY=$NGC_API_KEY \
  -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
  -v "$LOCAL_NIM_WORKSPACE:/opt/nim/workspace" \
  -p 8000:8000 \
  $IMG_NAME

The first start downloads the model and can take several minutes. The container runs in this terminal: leave it open, since you stop the NIM there, and open another one for the next step.

Step 5

Check that it answers

Command
curl -X 'POST' \
    'http://0.0.0.0:8000/v1/chat/completions' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
      "model": "meta/llama-3.1-8b-instruct",
      "messages": [
        {
          "role":"system",
          "content":"detailed thinking on"
        },
        {
          "role":"user",
          "content":"Can you write me a song?"
        }
      ],
      "top_p": 1,
      "n": 1,
      "max_tokens": 15,
      "frequency_penalty": 1.0,
      "stop": ["hello"]
    }'

The answer is a JSON object with the generated text. From another computer, replace 0.0.0.0 with the Spark’s address.

Stop and remove

Press Ctrl+C in the terminal where the NIM runs. It was started with --rm, so Docker removes the container when it stops. NVIDIA’s two commands below are for a container still running, or started without --rm: after Ctrl+C they answer that the container does not exist, which is expected. In a new terminal the values of Step 3 are not set: write nim-llm-demo in place of $CONTAINER_NAME.

Command
docker stop $CONTAINER_NAME
docker rm $CONTAINER_NAME

To free the disk as well, delete the model cache; the model will be downloaded again at the next start. In a new terminal, write ~/.cache/nim in place of "$LOCAL_NIM_CACHE":

Command
rm -rf "$LOCAL_NIM_CACHE"

When something fails

What you seeCauseWhat to do
Invalid credentials at sign-inThe key is wrong or has a space around itCopy the key again from the NGC portal.
The download hangs or failsNetwork, or not enough diskCheck the connection and the space in the cache folder.
Error 404 or connection refusedThe container has not finished startingWait for the end of the start-up, and check port 8000.
runtime not foundThe NVIDIA Container Toolkit is not configured for DockerRun sudo nvidia-ctk runtime configure --runtime=docker and restart Docker.
Memory errors although the model should fitThe system cache holds part of the shared memoryFree it with the command below.
Command
sudo sh -c 'sync; echo 3 > /proc/sys/vm/drop_caches'

To do for a production deployment

Before you rely on it in production

  1. Pin the NIM. The tag latest moves; note the version that worked. Understand Tech’s office box runs NIM 2.0.12.

  2. Run it in the background and make it start again after a reboot. The command above runs in the terminal and removes the container when it stops.

  3. Allow for a long start. Understand Tech’s published configuration gives its NIM 45 minutes before a failed health check counts, and one of its lessons records a start of about 30 minutes.

  4. Protect the address: the command publishes port 8000 to the network.

  5. Keep the cache folder on a disk that is backed up or easy to refill, and plan how a new model reaches a machine that has no internet access.

Where the commands come from

Sources

Read on 30 November 2026. Commands are copied from the sources. A step a source does not show is described in words.

Reference

Fact sheet

Where this comes from

NIM is how Understand Tech’s office boxes serve their models. NVIDIA publishes a short guide for running one on a DGX Spark; this tutorial follows it and adds what Understand Tech’s records say about start-up time and versions.

Machine

NVIDIA DGX Spark · 128 GB unified. A reference machine helps locate guidance; it does not establish identical behaviour on another maker’s system.

Software

NVIDIA NIM for LLMs, from NVIDIA’s NGC registry

Model

meta/llama-3.1-8b-instruct in the guide; other NIMs built for the Spark are in NVIDIA’s catalogue

Evidence

Commands from NVIDIA’s DGX Spark playbooks (Apache 2.0), read 30 November 2026 at a fixed commit. AI Deskside has not run them yet. The notes on start-up time come from Understand Tech’s public configuration file and from a lesson on AI Deskside.

Still open
  • Which NIMs exist for the Spark on the day you install
  • Start-up time of the NIM you choose, first start and restart
  • Speed and number of simultaneous users for your prompts
  • How to bring a NIM and its model to a machine with no internet access