Building and running the NeMo Guardrails Docker image

A practical guide to building the NeMo Guardrails server image from the repository, mounting configurations, adding provider packages and passing credentials on infrastructure you control.

On this page

Why teams build their own NeMo Guardrails Docker image

If you need a self-hosted guardrails server inside your own container platform, the NGC microservice is no longer an option. NVIDIA's NeMo microservices were sunset as of October 1, 2026, with no new releases and no continued support for the artifact. The open-source route is the NeMo Guardrails library itself, which is licensed under Apache 2.0 and developed in the NVIDIA-NeMo/Guardrails repository. The repository includes a Dockerfile for building a server image, so the container is one you build, version, scan and run yourself rather than a vendor artifact you pull. That shifts ownership of the base image, patching and registry hosting to your team or your implementation partner.

The server image runs the guardrails server, which loads configurations from a folder (a config.yml file with optional Python actions and Colang files) and exposes an HTTP API. Teams usually build the image when several applications, languages or teams need to call one shared policy over HTTP, when the security team wants a single artifact to review and sign, or when the platform team already runs containers and wants guardrails to deploy like any other service. Teams usually embed the Python library instead when one Python application owns its own rails and latency per call matters more than central control. Version 0.25.0 requires Python 3.11, 3.12 or 3.13, so the build base image and any local test environment must match that range. Confirm that requirement against the release you pin before you choose a base image.

How the image, mounted configuration and credentials fit together

The diagram starts with the repository and its Dockerfile, which produce the server image. At run time, the container reads a mounted configuration folder holding config.yml, Colang files and any Python actions, while credentials and the optional LangChain flag arrive as environment variables. The HTTP API is the main service; the AlignScore and heuristics containers are separate services that the configuration calls over the network. Check that each hand-off is explicit, especially which service holds which key and whether the detectors are reachable from the server.

Image build, runtime inputs and the optional detector services.

Image build options and when each fits

This table compares three ways to produce a NeMo Guardrails server image: building from the repository at a pinned release tag, installing the published nemoguardrails package from PyPI into a custom image, and adding LangChain provider packages or leaving them out. Read each row as a decision about who owns the dependency set and the upgrade work. The main takeaway is that the more of the build your team controls, the more of the provenance, testing and rebuild effort lands on your side.

Build optionWhen it fitsWhat your team owns and the main trade-off
Repository build at a pinned tagTeams that want the Dockerfile and server code exactly as NVIDIA tagged it, and can pin to a known release such as 0.25.0You own the build pipeline and tag selection. Trade-off: you must rebuild and retest for each new tag you adopt, and the Dockerfile may change between releases.
Custom image from the PyPI packageTeams that already maintain a base image standard and want to control the Python version and installed packagesYou own the Dockerfile, base image patching and Python runtime. Trade-off: the image contents depend on your own package set, so confirm the server entry point and config path against the release you install.
Custom image with LangChain packages addedApplications that load LangChain-based models and will set NEMOGUARDRAILS_LLM_FRAMEWORK=langchainYou own every provider package version you add. Trade-off: the LangChain integration is opt-in, so images without it stay smaller but fail if the variable is set without the package.
Image without LangChain packagesDeployments that call models through supported providers configured directly in the configuration filesYou own a smaller dependency list and fewer transitive updates. Trade-off: any framework-dependent setting must be verified in testing before promotion.
Python version matchAll options, since the library requires Python 3.11, 3.12 or 3.13 for release 0.25.0You choose the base image Python version within that range. Trade-off: a base image outside the supported range will fail at install, so confirm the version in your build test.
Pinned release referenceAny option that must reproduce the same image later for audit or change controlYou record the release number and build inputs. Trade-off: pinning reduces surprise but adds a scheduled review to move forward.

Build, mount and run the server image

This sequence takes you from a pinned NeMo Guardrails release to a running guardrails server container that loads your configuration, receives credentials securely and answers HTTP requests. Each step ends with a check you can repeat after every change.

  1. Pin the release and clone the repository

    Choose the NeMo Guardrails release you will deploy, check the release notes for breaking changes, and clone the NVIDIA-NeMo/Guardrails repository at that tag so the image is built from source you can name and reproduce. The current release is 0.25.0, which requires Python 3.11, 3.12 or 3.13, so confirm your base image and build tooling match. You know this step is done when the checked-out commit matches the release tag and you have recorded that tag in your change record.

  2. Build the server image from the Dockerfile

    Run the Docker build against the Dockerfile in the cloned repository, tag the result with the release version and a internal registry path, and push it to a registry your cluster or hosts can reach. Have your platform or security team review the base image and any packages the build pulls in, because you own that supply chain once it is in your environment. You know this step is done when the image builds without errors and the tagged image appears in your registry with a digest you can reference later.

  3. Prepare the configuration folder

    Create a configuration folder containing config.yml, any Python actions and any Colang files your rails need. Keep this folder in version control so every change to models, rails or prompts is reviewed and traceable. If you are migrating Colang 1.0 files, run the nemoguardrails convert tool and plan a manual review of the output, since NVIDIA states converted configurations still need that review. You know this step is done when the folder loads locally with the nemoguardrails CLI or Python API before you containerize it.

  4. Mount configuration and start the container

    Start the container with the configuration folder mounted read-only at the path the server reads, and expose the HTTP port only on the network segment your applications use. Pass the server start options the image documents for selecting the configuration. Mounting configuration rather than baking it into the image lets you change policy without rebuilding the image. You know this step is done when the container stays running and its logs show the server starting without configuration errors.

  5. Pass credentials through environment variables or secret injection

    Supply model provider keys and other credentials as environment variables injected by your secret manager or orchestrator, never as values in config.yml or in the image. Confirm with your security team how those variables are stored, rotated and excluded from logs and container inspection output. Ask the vendor or your own review which variable names each provider expects. You know this step is done when the container reads the credentials at start, and a search of the configuration folder and image layers finds no plaintext keys.

  6. Enable LangChain only when needed

    Leave LangChain integration off unless a rail or model path requires it. When it is required, set NEMOGUARDRAILS_LLM_FRAMEWORK to langchain and install the matching LangChain provider packages in a derived image, so the set of installed packages is explicit and reviewable. The integration is opt-in, so a default deployment does not need it. You know this step is done when the server's loaded packages match the list you approved and the provider calls succeed in a test request.

  7. Start the optional AlignScore and heuristics containers

    If your rails use AlignScore or the jailbreak heuristics, run them as separate containers from their own images, following the repository and documentation for each, and point the guardrails configuration at their internal endpoints. Keeping them separate lets you scale and monitor each detector on its own. Confirm the endpoint addresses in config.yml match the service names on your network. You know this step is done when each detector container reports healthy and a test request exercising its rail reaches it.

  8. Verify the loaded configuration over the HTTP API

    Send a request to the health endpoint, then query the server for the configurations it has loaded and send a test prompt that should trigger each rail you configured, including one that should be blocked. Compare the responses with the expected results you wrote down before the build. Record the image digest, release tag and configuration commit in your deployment record. You know this step is done when every expected rail fires, the loaded configuration matches your version control commit, and the results are saved as your baseline for later upgrades.

Passing credentials and adding provider packages by situation

A single-provider deployment is the simplest case. The server talks to one model endpoint, so the image needs only the client package for that provider and one credential. Start from the stock image and add what the configuration requires, rather than installing every optional integration. LangChain support is opt-in and is enabled with the NEMOGUARDRAILS_LLM_FRAMEWORK=langchain environment variable, so add the LangChain provider package only when your configuration relies on it.

  • Pass the key at runtime: Supply the provider key as an environment variable when the container starts, for example with docker run -e, or through your orchestrator's secret mechanism.
  • Reference the variable in configuration: Keep the key out of config.yml and let the provider client read it from the environment.
  • Add only the needed package: Install the provider client package in a derived image layer only if the library does not already include what your model call path uses.
  • Set the framework variable deliberately: Set NEMOGUARDRAILS_LLM_FRAMEWORK=langchain only when a LangChain-based path is in use.
  • Rebuild on package changes: Any provider package change requires a new image tag so the running version is traceable.

Confirm the exact provider package name and version against the project's current dependency metadata before you pin it. Check the key's scope and rotation process with the provider.",

When to run AlignScore and heuristics as separate images

AlignScore and the jailbreak heuristics can run inside the guardrails process or as their own containers that rails call over the network. Each choice changes how you size, configure, monitor and upgrade the server, so decide it before you build the image.

Optional AlignScore server

AlignScore is a fact-consistency scorer used by grounding and hallucination checks in RAG assistants. Running it as its own container keeps its model weights and compute out of the guardrails server image, so you can scale and patch it separately. Only build this container if a rail in your configuration uses AlignScore. Confirm in the documentation which image and version your guardrails release expects.

NeMo Guardrails docs

Jailbreak heuristics server

The heuristics server hosts the perplexity-based jailbreak checks as a separate HTTP service. Your rails send text to it and receive a verdict, so the guardrails server stays light and the checks can run on their own hosts. Ask the documentation which endpoints this server exposes and which heuristics it loads. Test each endpoint with a known benign and a known adversarial prompt before you connect it to production rails.

Why in-process heuristics need review

Running heuristics in the same process as the guardrails server is simpler to start with, but the detector then shares memory, CPU and failure domain with every request handler. Under load, a slow detector can slow the whole server, and a crash takes out both. Before production, confirm what the documentation advises for in-process use and test latency under your expected concurrency. Keep the separate-container pattern if those results do not meet your targets.

Monitor detector outages

If a detector goes down, the protection it provided may stop without any error reaching users. Depending on how the rail is configured, a failed call can block traffic, pass it through, or skip the check. Find out which behavior your version uses, then add health checks and alerts for each detector container. Include a periodic test request that the detector must flag, so you notice a silent failure.

Configuration keys that point rails at detectors

The rail definitions in config.yml hold the endpoint each detector is reached at, so a container name or port change must be reflected there. Confirm the exact key names and the endpoint format in the documentation for your release, and keep them in the mounted configuration rather than in the image. Use the Docker network name of each detector service so the guardrails server reaches it without a public route.

Pin detector and server versions together

Build the guardrails server from a tested release, such as 0.25.0, and pin each detector image to the version the documentation pairs with it. Upgrading one side without the other can break the endpoint contract that rails depend on. Record both tags in your build pipeline and retest the detector rails after every upgrade of either image.

Questions teams ask before building the image

What does it cost to build the NeMo Guardrails Docker image in-house?

The direct cost is engineer time, and it is mostly one-time. Your team pays for the work to write the Dockerfile wrapper, pin the Python version, choose which LangChain or provider packages to add, wire in credentials from your secrets store, and test the resulting server. The main cost drivers are how many model providers you connect, how many configurations you ship, and whether you also build the AlignScore or heuristics server images. The open-source license is Apache 2.0, so the software itself carries no license fee, but registry storage, build runners and ongoing rebuilds are recurring costs. Ask any partner for a quote built from a written scope that lists each provider, configuration and image.

How long does a first build and test take?

Duration depends on scope, and no fixed figure applies to every team. A single provider, one configuration and a standard container platform is the smallest case. Duration grows with each added provider package, each safety model endpoint, each configuration that must be tested separately, and each approval step in your change process. The first build also takes longer than later ones because pipelines, base image policy and secret handling are set up once. Confirm the timeline with your own platform team, since their registry, scanning and release rules often set the pace more than the build itself.

What must our team supply before the build starts?

Most of the dependencies sit outside the image, so have them ready before work begins. You need:

  • A container platform where the image will run, with a build runner that can reach the NeMo Guardrails source and PyPI, or a mirror of both
  • A private registry and an agreed tagging and signing policy
  • Accounts and keys for each model provider, stored in your secrets manager
  • Named owners for each configuration, including the config.yml, Colang files and any Python actions
  • A test environment that mirrors production network paths

Missing config owners are the most common blocker, because someone must decide which rails apply before the image can be validated.

Can an in-house platform team build and run this alone?

Yes, a team with container and Python experience can build the image without outside help, provided it has the time and owners described above. The harder part is ongoing: the library moves between releases, and the 0.25.0 line deprecates the LLMRails class in favor of Guardrails, so upgrades need regression tests against your configurations. Check the migration guide before pinning a version. If your team already operates containers and secrets for other services, the skills gap is usually small. The gap is larger when no one owns Colang configuration or model evaluation.

When is outside help worth scoping for this work?

Outside help is worth scoping when the build sits on a deadline, when several teams need separate configurations, or when your auditors will ask for evidence of how the image was built and tested. It is also useful when you need a second pair of eyes on the security posture of the container, including how credentials are passed and which network calls remain. DeployOpen plans, implements, hardens and documents self-hosted platforms inside your own infrastructure, and most engagements are fixed-scope with deliverables and timelines agreed in writing before work starts. Ask for the written scope to list the image, the providers, the test plan and the handover.

Which NeMo Guardrails version should we pin in the image?

Pin a specific release rather than building from a moving branch, and confirm the Python version first. The current release is 0.25.0, published on 19 November 2026 to PyPI under Apache-2.0, and it requires Python 3.11, 3.12 or 3.13. The previous release was 0.24.1. Whichever version you choose, read the 0.25 migration guide if you use LLMRails, and test your Colang configurations, since converted Colang 1.0 configurations still need manual review.

Does the NeMo Guardrails microservice still change this plan?

Yes, it changes which artifact you build from. NVIDIA's NGC catalog page says the NeMo microservices container has been sunset as of 1 October 2026, with no new releases and no support, and NVIDIA's archived documentation directs existing users to their account team. The self-built image described here comes from the open-source library and its Dockerfile, so it does not depend on that container. Confirm with NVIDIA and your account team how any existing microservice deployment will be handled, and do not treat the sunset as a reason to delay this build.

How DeployOpen scopes and delivers the NeMo Guardrails image

DeployOpen plans and builds the NeMo Guardrails server image inside your own build pipeline and registry, then hands over the Dockerfile, configuration layout and run instructions. Engagements are fixed-scope, with the image, configuration mounts, provider packages and optional detector images agreed in writing before work starts.

How we scope

  • We confirm which NeMo Guardrails release and Python version (3.11, 3.12 or 3.13) your image will target.
  • We list the LangChain provider packages, model endpoints and credential sources the configurations need.
  • We agree in writing whether AlignScore or heuristics server images are in scope, and what each one protects.

How we build

  • We build the image from the official repository Dockerfile, pinned to the release you approve, in your build system.
  • We set up configuration mounts, environment variables and secret injection so no credentials are baked into the image.
  • We test the image locally and in your staging environment, checking startup, the HTTP API and each configured rail.

How we hand over

  • We deliver the Dockerfile, build scripts, image tags and a README covering mounts, variables and run commands.
  • We document how to add a provider package, rebuild the image and roll back to the previous tag.
  • We walk your platform and security teams through the image, its configuration layout and the evidence it produces.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers, scoped separately from the build.
  • We can rebuild the image when you adopt a new NeMo Guardrails release and document the configuration changes to review.
  • Your team should confirm its own registry, scanning and promotion policies before we hand over the pipeline.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.