Docker for Node.js
Run the VIESUS Node.js module in a GPU-enabled Docker container. Dockerfile, build, and run instructions for Linux production deployments.
Containerizing the Node.js module follows the same foundation as the CLI Docker setup — the VIESUS .deb packages are installed inside the container, then the npm module is linked from the installed location.
Prerequisites
Docker Engine installed on the host
NVIDIA Container Toolkit installed (for GPU support)
VIESUS
.debpackages (.debfiles must be in your build context)
If you do not already have the NVIDIA Container Toolkit:
# Add NVIDIA Container Toolkit repository
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart dockerBuild context
Prepare the directory you'll build from:
Dockerfile
Build the image
Run the container
CPU mode
GPU mode
When using GPUs, set UV_THREADPOOL_SIZE to the number of GPUs, not the number of CPU cores. See GPU Scaling.
Passing the GUID securely
Never hardcode the GUID in the Dockerfile or application code. Pass it at runtime:
Read the GUID in your application:
Docker Compose example
Run with:
Production considerations
Image size
Use multi-stage builds to reduce final image size; the CUDA runtime base is large
GUID security
Pass via environment variable or secret manager — never bake into the image
Graceful shutdown
Handle SIGTERM to allow in-flight requests to complete before the pool closes
Health check
Add a lightweight GET /health endpoint that returns 200; use it for readiness probes
Logging
Stream stdout/stderr — Docker captures it; ship to your log aggregator
GPU reservation
Use --gpus all or specify by device ID if only some GPUs should be used
Last updated
Was this helpful?
