Skip to content

How-to

Docker ​

This guide runs the nocturn daemon as a container with Docker Compose, keeps its data in a volume, and shows how to pair, update, back up and read the logs. You need Docker with the Compose plugin and an OpenAI-compatible model endpoint with an API key.

The image comes with the next release

Releases publish the image to ghcr.io/efuturetoday/nocturn, tagged with the version (0.5.0) and latest. The pipeline was added after 0.4.0, so 0.4.0 has no image. Until the next release, build it from a clone: docker build -t ghcr.io/efuturetoday/nocturn:latest .

What the image is ​

Imageghcr.io/efuturetoday/nocturn:<version> or :latest, for linux/amd64 and linux/arm64
Basegcr.io/distroless/static-debian12:nonroot: the static binary, no shell, no package manager
Runs asthe distroless nonroot user, UID and GID 65532
Commandnocturn serve, the browser UI built in
Port8080
Data/data/nocturn-data (workspaces, paired devices, vaults); the working directory is /data
Healthnocturn health, every 30 s: GET /healthz on 127.0.0.1:8080

The daemon has no TLS of its own. It is meant for your home network, or behind a VPN or an HTTPS reverse proxy (Remote access).

1. Write the environment file ​

Put the configuration next to the compose file. These are the same variables a binary reads (Configuration).

ini
OPENAI_BASE_URL=https://llm.home.example   # without /v1
OPENAI_API_KEY=your-key-here
OPENAI_MODEL=your-model-id

# Unlocks the vaults. Keep it somewhere safe: there is no recovery.
NOCTURN_MASTER_PASSPHRASE=a-long-passphrase

Keep the daemon on port 8080 inside the container and change only the published port. The health check and nocturn pair inside the container always dial 8080.

2. Write the compose file ​

yaml
services:
  nocturn:
    image: ghcr.io/efuturetoday/nocturn:latest
    container_name: nocturn
    restart: unless-stopped
    env_file: .env
    ports:
      - "8080:8080"
    volumes:
      - nocturn-data:/data/nocturn-data
    healthcheck: # the image's own; repeated here so it is visible
      test: ["CMD", "nocturn", "health"]
      interval: 30s
      timeout: 10s
      start_period: 60s
      retries: 3

volumes:
  nocturn-data:

Pin a version (:0.5.0) instead of latest if you want updates only when you choose them.

3. Start it ​

sh
docker compose up -d
docker compose ps        # STATUS turns to "healthy" within a minute

4. Get the pairing code ​

While no phone or browser is paired, the daemon logs a six-digit code once at start. It is valid for five minutes and five attempts.

sh
docker compose logs nocturn | grep '"code"'

The log is JSON, so look for "code":"482913". When the code has expired, or to pair another device, mint a new one inside the container:

sh
docker compose exec nocturn nocturn pair

It prints pairing code: 482913 and a browser link with 127.0.0.1 in it. Replace that address with your machine's address when you open the link from another device.

Then pair the app as in Getting started.

Find it on the network ​

The app finds a daemon by mDNS (_nocturn._tcp). Multicast does not leave Docker's default bridge network, and the address the container would announce is its bridge address, which your phone cannot reach. So on a bridge network the app does not list the daemon under On this network.

You have two choices:

  • Type the address. In the app, tap Enter address and type the machine's IP address and the published port, for example 192.168.1.20 and 8080. This works everywhere.

  • Use host networking (Linux only). The daemon then announces the host's addresses and name, and the app lists it as nocturn @ <host name>. Replace ports: with network_mode: host:

    yaml
    services:
      nocturn:
        # ...as above, without ports:
        network_mode: host

Where the data lives ​

Everything nocturn keeps is in the volume, at /data/nocturn-data in the container: one folder per workspace under workspaces/, the paired devices in devices.json, and master.salt, which the vaults need together with your passphrase. The folder layout is in Configuration.

A folder instead of a volume

To keep the data in a folder of the host, mount it in place of the volume (./nocturn-data:/data/nocturn-data) and give it to UID 65532 first: sudo chown -R 65532:65532 ./nocturn-data. A named volume needs no such step.

Run a command inside ​

Every nocturn command works inside the container, from the right folder and with the container's environment, the passphrase included:

sh
docker compose exec nocturn nocturn ls -w main
docker compose exec nocturn nocturn perms show
printf %s "$TOKEN" | docker compose exec -T nocturn nocturn secret set acme
docker compose exec nocturn nocturn reload

-T passes stdin through, so a secret's value stays out of your shell history and the command line.

Read the logs ​

sh
docker compose logs -f nocturn

The daemon writes JSON lines to stderr. Set NOCTURN_LOG=debug in .env and run docker compose up -d again for more detail.

Update ​

sh
docker compose pull
docker compose up -d

Compose replaces the container and keeps the volume. With a pinned version, change the tag in compose.yaml first.

Back up ​

Stop the daemon so nothing writes while you copy, archive the volume, and start it again:

sh
docker compose stop nocturn
docker run --rm -v nocturn_nocturn-data:/data -v "$PWD":/backup alpine \
  tar czf /backup/nocturn-data.tgz -C /data .
docker compose start nocturn

Compose prefixes the volume with the project name (here the folder nocturn); docker volume ls shows the real name. A restore needs the same NOCTURN_MASTER_PASSPHRASE: the vaults inside are encrypted with it.

Behind an HTTPS reverse proxy ​

To reach nocturn from outside, put a reverse proxy with a trusted certificate in front of it, allow its name with NOCTURN_HOSTNAMES, and type https://<name> in the app; the app then connects with TLS (wss://). The steps are in Remote access.

Typing secrets through a proxy container

The daemon accepts a secret's value only over a private connection. It believes a proxy's X-Forwarded-Proto: https only when the proxy connects from the daemon's own address, as one on the same host with host networking does. A proxy in another container connects from a container address with forwarding headers, so the daemon refuses a value sent through it. Set such secrets from the home network or with docker compose exec instead.

nocturn is open source. Example hosts and people on these pages are made up.