# Hardening

Source: https://zshot-cli.com/reference/docker/hardening/
Markdown: https://zshot-cli.com/reference/docker/hardening/index.md
Section: [Reference](https://zshot-cli.com/reference/) › [Docker](https://zshot-cli.com/reference/docker/)

Chromium's process sandbox is the main barrier between a hostile page and the host, and the ZShot Docker images keep it on. Under Docker it needs user namespaces, which the default seccomp profile blocks, so run the image with the profile that ships inside it:

```sh
docker run --rm --entrypoint cat scaleassembly/zshot /usr/share/zshot/zshot-seccomp.json > zshot-seccomp.json
docker run --rm --security-opt seccomp=zshot-seccomp.json \
  scaleassembly/zshot https://zshot-cli.com/example_assets/hello_zshot/ -f out.png
```

The profile is Docker's default plus `clone`, `unshare`, and `chroot`, which the sandbox uses to put each renderer in its own user, PID, and network namespace. Without it the image renders without the sandbox and says so:

```
WARNING: Chromium's sandbox cannot start here: the runtime blocks unprivileged user namespaces. Container mode is running without it; see https://zshot-cli.com/reference/linux/#hardening
```

[`--quiet`](/reference/flags/common/quiet) silences the warning, and [`--diagnostics`](/reference/flags/common/diagnostics) reports the verdict as a `Chromium namespace sandbox` line.

## Recommended Runtime Settings

The profile supports the strictest runtime settings, and every one of them applies:

```sh
docker run --rm \
  --security-opt seccomp=zshot-seccomp.json \
  --cap-drop=ALL --security-opt no-new-privileges \
  --read-only --tmpfs /tmp --pids-limit 512 \
  scaleassembly/zshot https://zshot-cli.com/example_assets/hello_zshot/ -f out.png
```

The same settings as a Compose service, published as [docker-compose.yml](/reference/docker/files/docker-compose) beside the [profile](/reference/docker/files/zshot-seccomp); both are exercised against every release:

```yaml
services:
  zshot:
    image: scaleassembly/zshot-server
    environment:
      ZSHOT_LICENSE: MY-ZSHOT-LICENSE-KEY
    ports: ["3000:3000"]
    security_opt:
      - seccomp=./zshot-seccomp.json
      - no-new-privileges=true
    cap_drop: [ALL]
    read_only: true
    tmpfs: [/tmp]
    pids_limit: 512
```

## Runtime Notes

- Keep the default AppArmor profile. On Ubuntu 24.04 and later, `--security-opt apparmor=unconfined` blocks user namespaces and the sandbox with them.
- Podman's default seccomp profile already permits the sandbox. The profile above still matters with `--cap-drop=ALL`, which removes the capability Podman's `chroot` rule keys on.
- [Kubernetes](/reference/docker/kubernetes) runs pods with no seccomp filter unless the namespace requires one.

## Confirming the Sandbox

A sandboxed renderer shows two seccomp filters and a nested PID namespace in `/proc/PID/status`:

```
Seccomp_filters:	2
NSpid:	92	5	1
```

## Related

Flags:

- [`--container`](https://zshot-cli.com/reference/flags/security/container/)
- [`--no-sandbox`](https://zshot-cli.com/reference/flags/security/no-sandbox/)
- [`--diagnostics`](https://zshot-cli.com/reference/flags/common/diagnostics/)

Topics:

- [Kubernetes](https://zshot-cli.com/reference/docker/kubernetes/)
- [zshot-seccomp.json](https://zshot-cli.com/reference/docker/files/zshot-seccomp/) — The seccomp profile
- [docker-compose.yml](https://zshot-cli.com/reference/docker/files/docker-compose/) — The hardened Compose service

## Navigation

- [Examples](https://zshot-cli.com/examples/)
- [Download](https://zshot-cli.com/download/)
- [Purchase](https://zshot-cli.com/purchase/)
- [Reference](https://zshot-cli.com/reference/)
  - [Formats](https://zshot-cli.com/reference/formats/)
  - [Flags](https://zshot-cli.com/reference/flags/)
  - [Agents](https://zshot-cli.com/reference/agents/)
  - [Configuration](https://zshot-cli.com/reference/configuration/)
  - [Crawling](https://zshot-cli.com/reference/crawling/)
  - [Docker](https://zshot-cli.com/reference/docker/)
    - [Environment](https://zshot-cli.com/reference/docker/environment/)
    - **Hardening**
    - [Kubernetes](https://zshot-cli.com/reference/docker/kubernetes/)
    - [Railway](https://zshot-cli.com/reference/docker/railway/)
    - [Files](https://zshot-cli.com/reference/docker/files/)
  - [Exit Codes](https://zshot-cli.com/reference/exit_codes/)
  - [Linux](https://zshot-cli.com/reference/linux/)
  - [LLM Connections](https://zshot-cli.com/reference/llm_connections/)
  - [LLM Formatting](https://zshot-cli.com/reference/llm_formatting/)
  - [Local Inputs](https://zshot-cli.com/reference/inputs/)
  - [Navigator](https://zshot-cli.com/reference/navigator/)
  - [Security](https://zshot-cli.com/reference/security/)
  - [Server](https://zshot-cli.com/reference/server/)
  - [Shell completions](https://zshot-cli.com/reference/shell_completions/)
  - [Storage](https://zshot-cli.com/reference/storage/)
  - [Timeouts](https://zshot-cli.com/reference/timeouts/)
  - [Web Bot Auth](https://zshot-cli.com/reference/web_bot_auth/)
- [Support](https://zshot-cli.com/support/)
- [Changelog](https://zshot-cli.com/changelog/)

Site index: https://zshot-cli.com/llms.txt

