dhi.io/snyk
Find and fix vulnerabilities in code, dependencies, containers, and infrastructure as code
All examples in this guide use the public image. If you've mirrored the repository for your own use (for example, to your Docker Hub namespace), update your commands to reference the mirrored image instead of the public one.
For example:
dhi.io/<repository>:<tag><your-namespace>/dhi-<repository>:<tag>For the examples, you must first use docker login dhi.io to authenticate to the registry to pull the images.
Most Snyk commands require authentication. Provide an API token through the SNYK_TOKEN environment variable when
running the container.
Replace <tag> with the image variant you want to run.
# Check the Snyk CLI version
$ docker run --rm dhi.io/snyk:<tag> --version
Mount your project and pass your API token:
$ docker run --rm -e SNYK_TOKEN -v "$PWD:/project" -w /project dhi.io/snyk:<tag> test
$ docker run --rm -e SNYK_TOKEN dhi.io/snyk:<tag> container test alpine:3.20
The Snyk CLI ships an MCP server in the same binary. Start it over stdio so an AI assistant can call Snyk scans as tools:
$ docker run --rm -i -e SNYK_TOKEN dhi.io/snyk:<tag> mcp -t stdio
# syntax=docker/dockerfile:1
FROM dhi.io/snyk:<tag> AS scan
ARG SNYK_TOKEN
COPY . /project
WORKDIR /project
RUN snyk test --severity-threshold=high
| Feature | Standard Snyk images | Docker Hardened Snyk |
|---|---|---|
| Security | Standard base with common utilities | Hardened base with reduced utilities |
| Package manager | Full package managers (apk, apt) | System package managers removed |
| User | Runs as root | Runs as nonroot user |
| Attack surface | Full system utilities available | Significantly reduced |
Runtime variants are designed to run Snyk commands in production and CI. These images typically:
docker debug for any debugging needsDev variants include -dev in the variant name and tag. They are build-time images intended for multi-stage
Dockerfiles. These variants:
FIPS variants include -fips in the variant name and tag and are published for the Debian-based image only
(upstream provides no FIPS build for Alpine). They ship the official Snyk FIPS CLI binary, which provides FIPS 140
validated cryptography through the system OpenSSL and its FIPS provider, both included in the image. FIPS mode is
enforced: the binary refuses to start if the FIPS provider is unavailable. Usage is otherwise identical to the
corresponding runtime and dev variants. For example, usage of MD5 fails in FIPS variants.
To migrate from the official snyk/snyk images to Docker Hardened Images, update your deployment configuration and
potentially your Dockerfile.
| Item | Migration note |
|---|---|
| Base image | Replace snyk/snyk images with Docker Hardened Snyk images |
| Entrypoint | The entrypoint is snyk; pass subcommands such as test or mcp directly |
| Package management | System package managers removed in runtime variants |
| Non-root user | Runtime images run as the nonroot user |
| Authentication | Provide SNYK_TOKEN as an environment variable rather than baking in config |
Most Snyk commands require an authenticated session. Pass -e SNYK_TOKEN to the container, or run snyk auth from a
dev variant to populate the configuration mounted at the user's home directory.
By default, runtime image variants run as the nonroot user. Snyk writes its cache and configuration under the home
directory (/home/nonroot). Ensure any mounted project files are accessible to the nonroot user.
Non-dev hardened images run as a nonroot user by default. As a result, applications in these images can't bind to privileged ports (below 1024) when running in Kubernetes or in Docker Engine versions older than 20.10.