# Run Savorum with Docker

Source: https://docs.savorum.app/admin/docker/

> Choose a Savorum image, manage its container, and keep your library safe.

Savorum runs in one container, with its web app, database, and recipe storage included.

For your first library, follow [Install and start Savorum](https://docs.savorum.app/start/getting-started/#install-and-start-savorum). You can also use a NAS or container manager or use Docker Compose.

## Choose an image

| Image | Use |
| --- | --- |
| `ghcr.io/savorum/savorum:documents` | Includes PDF and photo import, with English text recognition. Used in the getting started guide and Unraid template. |
| `ghcr.io/savorum/savorum:latest` | A smaller image if you don’t need PDF or photo import. |

Both tags follow the latest stable release. Pulling an updated image and replacing the container upgrades Savorum; restarting an existing container keeps its current image. To stay on a particular version, pin a release.

See [PDF and photo import settings](https://docs.savorum.app/admin/configure/#set-up-pdf-and-photo-import) for limits and configuration.

Both images use the same `/data` volume, port, user, and health check. You can switch between them by replacing the container and keeping its data volume.

## Use a NAS or container manager

You can run the same image through a Docker interface, such as Synology Container Manager. Create one container with these settings; field names vary by tool:

| Setting | Value |
| --- | --- |
| Image | `ghcr.io/savorum/savorum:documents` |
| Container port | `8080` over TCP. Map it to an available port on your host. |
| Persistent storage | A Docker volume or local folder mounted read-write at `/data`. See folder permissions. |
| Network | Bridge. |
| Restart policy | Unless stopped, or the equivalent option in your tool. |

Leave the image’s startup command and user at their defaults. Add the environment variables for your address and network setup.

On Unraid, [install Savorum from Community Applications](https://ca.unraid.net/apps/savorum-16270ab1hgxdnj). Its template supplies these settings. Set **Server address**, check **Web port** and **Appdata**, then select **Apply**. Other options are under **Show more settings**.

A port published by a NAS interface may be reachable by other devices. Keep access restricted to yourself while you create an administrator and turn on sign-in. Then open your library at the address and host port you configured. For access outside your home, follow [Secure remote access](https://docs.savorum.app/admin/remote-access/).

## Use Docker Compose

Compose lets you keep the container’s settings in a file. It runs the same single container and uses a published image.

Create an empty folder and save this as `compose.yaml` inside it:

```yaml
services:
  savorum:
    image: ghcr.io/savorum/savorum:documents
    restart: unless-stopped
    read_only: true
    cap_drop:
      - ALL
    security_opt:
      - no-new-privileges:true
    environment:
      SAVORUM_DNS_SD: "false"
      XDG_CACHE_HOME: /data/.cache
    ports:
      - "127.0.0.1:8080:8080"
    volumes:
      - savorum-data:/data
    tmpfs:
      - /tmp:size=256m,mode=1777
    stop_grace_period: 30s

volumes:
  savorum-data:
    name: savorum-data
```

From that folder, start it:

```sh
docker compose up -d
```

Open [http://127.0.0.1:8080](http://127.0.0.1:8080/) on the same computer. Run Compose commands from this folder so they use your file.

This file uses the `savorum-data` volume from the getting started guide. If you’re switching from that guide’s `docker run` setup, stop and remove its container with `docker stop savorum` and `docker rm savorum` before starting Compose. Keep the volume. Run only one Savorum container against it at a time.

## Where your data lives

Savorum keeps everything in the volume mounted at `/data`: the database at `/data/savorum.db` and your photos and files in `/data/assets`. It runs as user and group `65532`. Keep the data volume when replacing a container. `docker compose down --volumes` deletes it and its contents.

With the settings in the examples, the data volume contains:

- ### /data/

  - savorum.db the database

  - ### assets/ recipe photos and original files

    - …

  - ### savorum.db.webhook-secrets/ webhook signing keys, when present

    - …

  - ### .cache/ the print compiler cache

    - …

  - … database sidecars and temporary work

Both images set `TMPDIR=/data` so temporary work uses the data volume. Backup verification and encrypted restore need more space than the default `/tmp` memory limit. You can override `TMPDIR` with another writable, disk-backed mount.

For a host folder instead of a volume, create it first, owned by `65532:65532` with mode `0700`. If several host accounts must share it, use a dedicated group, a `0770` setgid folder, and `SAVORUM_STORAGE_ACCESS=group`. Keep Savorum running as `65532:65532` and avoid world-readable storage. The Unraid template prepares its Appdata folder at startup.

Write backups to a separate mounted folder, not inside `/data`. See [Back up and restore an instance](https://docs.savorum.app/admin/backup-restore/).

## Change settings

Pass `SAVORUM_*` [settings](https://docs.savorum.app/admin/configure/) as `-e NAME=value` options before the image name in `docker run`. With Compose, put them under the service’s `environment:` section.

In a NAS or container manager, add each variable by name and value in the container’s environment settings. The common ones are:

| Variable | Value |
| --- | --- |
| `SAVORUM_PUBLIC_URL` | The full address people use to open Savorum, including `http://` or `https://` and the port if needed. Other addresses are rejected. |
| `SAVORUM_AUTH_ENABLED` | `true` after creating an administrator. |
| `SAVORUM_DNS_SD` | `false` with bridge networking, where local network discovery doesn’t reach other devices. |
| `XDG_CACHE_HOME` | `/data/.cache` to keep the print compiler’s cache on writable, persistent storage. |

For a reverse proxy, see [Secure remote access](https://docs.savorum.app/admin/remote-access/) for `SAVORUM_TRUSTED_PROXIES`. For an outside sign-in service, see [Single sign-on](https://docs.savorum.app/admin/single-sign-on/) for `SAVORUM_AUTH_PROVIDERS_FILE` and file mounts.

Changing environment variables requires replacing the container. For `docker run`, stop and remove the container, then repeat your run command with the new settings and the same data volume. With Compose, edit the file and run `docker compose up -d`. Stopping and starting an existing container keeps its original settings.

If you change the published port, set `SAVORUM_PUBLIC_URL` to match the address people use. Savorum refuses requests for any other address.

## Turn on sign-in

The getting started command and Compose example bind to `127.0.0.1`, so only the host can reach Savorum. Before opening it up, create an administrator inside the running container:

- Docker CLI
- Compose
- Container manager

```sh
docker exec --user 65532:65532 -it savorum /savorum user create-admin \
  --database /data/savorum.db --login chef
```

It asks twice for a password and prints the account’s user ID.

For unattended setup, pass `--password-file` with a mounted secret file readable only by `65532`, then remove the file once the account exists. See [Accounts and access](https://docs.savorum.app/admin/accounts/) for password requirements and other account commands.

Then replace the container with sign-in enabled and the address people will use:

- Docker CLI
- Compose
- Container manager

Add these options before the image name, replacing the example address:

```sh
-e SAVORUM_AUTH_ENABLED=true \
-e SAVORUM_PUBLIC_URL=https://recipes.example.com
```

Passkeys are tied to that address, so choose it before people add them. Follow [Secure remote access](https://docs.savorum.app/admin/remote-access/) before connecting from another device.

## Upgrade

1. Make and verify a [backup](https://docs.savorum.app/admin/backup-restore/).
2. Read the notes on the [releases page](https://github.com/savorum/savorum/releases).
3. Replace the container, keeping the same data volume and settings.

- Docker CLI
- Compose
- Container manager

Pull the image before stopping the container:

```sh
docker pull ghcr.io/savorum/savorum:documents
docker stop savorum
docker rm savorum
```

Repeat your `docker run` command with all your settings and the same `savorum-data` mount. If you use the smaller image, use `:latest` in both the pull and run commands.

Check that your library opens and its photos load. Database upgrades happen at startup. If an upgrade fails, or you need to return to an older release, see [Upgrade Savorum](https://docs.savorum.app/admin/maintenance/#upgrade-savorum).

### Pin a release

To choose each upgrade yourself, replace the moving tag with a full release tag from the [releases page](https://github.com/savorum/savorum/releases/latest):

- With document tools: `ghcr.io/savorum/savorum:vX.Y.Z-documents`.
- Smaller image: `ghcr.io/savorum/savorum:vX.Y.Z`.

Replace `vX.Y.Z` with the release tag, including the `v`. Use it in your run command, Compose `image:` field, or Unraid **Repository** field. For each upgrade, change the tag before pulling and replacing the container.

## Container console

Both images include Bash. Open a shell, replacing `savorum` with your container name:

```sh
docker exec -it savorum bash
```

If the console opens as root, as Unraid’s **Console** does, switch to the Savorum user before running commands:

```sh
su savorum
```

## Check the setup

1. Open `http://127.0.0.1:8080` and create a recipe.

2. Run `docker restart savorum` and confirm the recipe is still there. With Compose, use `docker compose restart savorum`.

3. Run the health check:

   Docker CLIComposeContainer manager`docker exec savorum /savorum healthcheck`

4. Practice a backup and restore into a second, empty volume, as described in [Back up and restore an instance](https://docs.savorum.app/admin/backup-restore/).

### Build an image from source

To build your own image, clone the [savorum repository](https://github.com/savorum/savorum) at your chosen release tag. From that folder:

```sh
docker build --target documents -t savorum:documents .
```

Use `savorum:documents` in place of the published image in your run command or Compose file. Use `--target minimal` to build the smaller image.

The repository’s own `compose.yaml` builds the smaller image from source with `docker compose up --build -d`. It uses a project-scoped data volume; check its volume name before switching to a different setup.

## Good to know

- Savorum limits memory for each import and print, but not for the container as a whole. Set a container memory limit with `--memory` in `docker run` or `mem_limit` in Compose, especially with the document-tools image or when other people can upload files.
- The examples give Savorum 30 seconds to shut down cleanly. Don’t wrap the entrypoint in a shell script that swallows the stop signal.
- Keep the database and assets on a local disk, not a network drive.
