Install with Docker
Kryspal Media runs as two containers, the server and its PostgreSQL database, started with one Docker Compose file. The images support x86 (amd64) and ARM (arm64).
On this page
- Before you start
- Install with one command (Linux host or VPS)
- Install a second copy on the same machine
- Install on a NAS with Docker Compose
- NAS file permissions
- Ports, folders and data
- Extras you can add
- Use your own PostgreSQL
- Automated deployments
- The server keeps restarting and the log says "the data directory does not match this database"
- After a NAS or Docker restart, Kryspal Media will not open
- Next
Before you start#
- Docker and Docker Compose v2 are installed.
- You know where your media lives on the host (for example
/volume1/movies).
Install with one command (Linux host or VPS)#
For a Linux machine or VPS that already has Docker. The script writes the compose file, starts it and waits until the server is healthy. Replace /srv/media with the folder that holds your movies and TV shows:
curl -fsSL https://media.kryspal.net/install.sh | bash -s -- --media /srv/media
Run the same command again to upgrade; see Upgrade and back up.
-
Read the script first. Download it, read it, then run it:
curl -fsSL https://media.kryspal.net/install.sh -o install.sh less install.sh bash install.sh --media /srv/media -
More than one media folder. Repeat
--media, for example--media /volume1/movies --media /volume2/tv. One folder is mounted at/media; with several, each is mounted at/mediaplus its full path, such as/media/volume1/movies. To keep other container paths, see Media outside /media.curl -fsSL https://media.kryspal.net/install.sh | bash -s -- \ --media /volume1/movies \ --media /volume2/tv
On an upgrade --media is ignored; to change the folders, edit compose.yaml.
- Where things are. The compose file and a small .env are in /opt/kryspal-media (change it with --dir). The data is in the Docker volumes kryspal-media_data, kryspal-media_pgdata and kryspal-media_db.
- If Docker is missing, the script stops and says where to get it. --install-docker lets it use Docker's official installer; --no-pull is for an offline host.
- What an upgrade does. It pulls the newest images and recreates the containers, and never deletes your data. Your compose.yaml stays as it is; if a new version changes it, the new file is saved next to it as compose.yaml.new.
- On a VPS, use --bind 127.0.0.1. Use it when a reverse proxy runs on the same machine. It publishes the two ports only on that address. Ports that Docker publishes bypass ufw and firewalld, so without --bind they are open to everyone. For IPv6 write --bind ::1. An upgrade keeps the address already in compose.yaml.
curl -fsSL https://media.kryspal.net/install.sh | bash -s -- --media /srv/media --bind 127.0.0.1
- Finish the setup wizard right away. Until it is done, anyone who can reach the port can create the administrator.
- Outside access. The port speaks plain HTTP, so put a reverse proxy with HTTPS in front of it and never forward port 5797. See Remote access.
- Not for a NAS. A project made from the command line is not shown in a NAS container manager. Use Docker Compose there.
Install a second copy on the same machine#
To run another server next to the first (for a test or a separate family), give the second one its own name and port:
curl -fsSL https://media.kryspal.net/install.sh | bash -s -- --name kryspal-two --port 6797 --media /srv/media2
--namesets the project name. The containers and Docker volumes are named after it, and without--dirthe files go to/opt/<name>. The default name iskryspal-media.--portsets the LAN port (default 5797). The outside-access port is that number plus one (default 5798), so keep both free.- Without these options nothing changes. If a server with the same name already lives in another folder, the script stops and tells you to upgrade it with
--dir <original folder>, or to install a separate copy with--nameand--port. An upgrade keeps the folder's own port and name and ignores both options.
Install on a NAS with Docker Compose#
Use this on Synology, QNAP and other NAS systems, where you create a project by pasting compose YAML into the container manager. Any other host with Docker can use it too.
-
Create a folder, and in it a file named
compose.yamlwith this content (in a NAS container manager, paste it where it asks for the compose file):services: server: image: kryspal/kryspalmedia:latest restart: unless-stopped stop_grace_period: 60s ports: - "5797:5797" # LAN - "5798:5798" # WAN # LAN discovery needs host network environment: EXTERNAL_HTTP_ADDR: ":5798" # WAN volumes: - /path/to/media:/media # 2+ folders: use these instead # - /mnt/movies:/media/mnt/movies # - /mnt/tv:/media/mnt/tv - data:/var/lib/mediaserver - db:/var/lib/kryspal-db:ro depends_on: - postgres postgres: image: kryspal/kryspalmedia-postgres:16 restart: unless-stopped stop_grace_period: 60s volumes: - pgdata:/var/lib/postgresql/data - db:/var/lib/kryspal-db volumes: data: pgdata: db: -
Replace
/path/to/mediawith your media folder on the host. For more than one folder, add onevolumesline per folder, mounted under/mediaplus its full path, for example- /mnt/tv:/media/mnt/tv. A folder mounted outside/mediais refused by the server. -
Start it (in a NAS container manager, create and start the project):
docker compose up -d -
Open
http://<host>:5797and follow the setup wizard to create the first administrator. See First-time setup. The admin console is athttp://<host>:5797/web/. - In your player (Infuse and others), enter the server address
http://<host>:5797and a member account.
NAS file permissions#
NAS with file ACLs (UGREEN, Synology and similar). The server runs as user mediaserver (uid and gid 1000) inside the container. On these systems the permission shown by ls is not the whole story: access is decided by the NAS's own ACL, which is often granted to a group such as admin, not to gid 1000. The symptom is "library root unavailable: … permission denied" (the library shows as offline) although the folder looks open to everyone. The one-line installer checks this for you: it tries each media folder with a throw-away read-only container and, when a folder cannot be read, adds the first group of your user that works as group_add in compose.yaml. With your own compose file, add the group that can read your media to the server service, then run docker compose up -d again:
group_add:
- "10" # the gid from `id -g` of the user that can read the files
To make the media folder completely read-only, add :ro to its line; subtitle download, NFO and image write-back, and deleting files then cannot work.
To upgrade, run docker compose pull and docker compose up -d. The database structure is upgraded automatically on first start; on a large library this can take a minute or two. See Upgrade and back up.
Ports, folders and data#
Automatic discovery. For players and apps on your local network to find the server by themselves, the container needs the host network (network_mode: host). The local-network broadcast (the discovery request on 7359/udp) does not reach a container on the default bridge network, and adding a 7359:7359/udp port mapping does not help.
On the default bridge network, automatic discovery usually does not work. Enter the server address in the player instead, for example http://192.168.1.10:5797; every player supports that.
If you switch to the host network, note that:
- The
ports:mappings no longer apply. The server uses 5797, 5798 and 7359 on the host directly. - If Emby or Jellyfin runs on the same machine, 7359 will clash.
- The server also listens on the host's loopback address for its admin port, 8097 (the
ADMIN_ADDRenvironment variable,127.0.0.1:8097by default in the image). If another program on the machine already uses 8097 (Emby, for example), the server fails to start; setADMIN_ADDRto something else, such as127.0.0.1:28099. The variable isADMIN_ADDR, notADMIN_PORT. - The server can no longer reach the database by the name
postgres. Publish a port on the database container for this machine only, and pointDB_HOSTandDB_PORTat it.
An example that changes only the server service, plus one port line on postgres (keep the rest of the compose file as it is):
services:
server:
image: kryspal/kryspalmedia:latest
restart: unless-stopped
stop_grace_period: 60s
network_mode: host
environment:
EXTERNAL_HTTP_ADDR: ":5798" # WAN
DB_HOST: 127.0.0.1
DB_PORT: "15432"
volumes:
- /path/to/media:/media
- data:/var/lib/mediaserver
- db:/var/lib/kryspal-db:ro
depends_on:
- postgres
postgres:
image: kryspal/kryspalmedia-postgres:16
ports:
- "127.0.0.1:15432:5432"
| What | Details |
|---|---|
| HTTP port | 5797. Players, the Kryspal web player and the admin console all use it. |
| Outside-access port | 5798. Forward only this one on your router; connections that arrive here always count as outside your network. |
| Discovery port | 7359 (UDP). Automatic discovery works only on the host network; see Automatic discovery above. |
| Server data | The data volume (/var/lib/mediaserver): keys, settings, imported and uploaded images, installed plugins, and the image cache (thumbnails and pre-generated posters; the cache is rebuilt if you delete it). Back it up. |
| Database | The pgdata volume in the database container. Items, members, watch history. |
| Database password | The db volume. The password is generated automatically on first start and shared between the two containers; you never type it. |
| Database port | 5432 is not published to the host. Only the Docker network can reach it. |
| Media | Mounted at /media inside the container (the example mounts /path/to/media). With several folders from the install script, each one is at /media plus its full path, for example /media/volume1/movies. When you create a library in the admin console, enter the path as the container sees it, for example /media/Movies. Your media folders are read-only by default; Kryspal writes to them or deletes files in them only when you turn on subtitle download, write-back (NFO and images) or Allow deletion on a library. |
The database is not reachable from outside, and its password is generated for you.
Container network (bridge mode) and the Kryspal apps. In a container network the server only sees the container's own address, so it cannot tell the apps where it is on your home network. If you leave LAN discovery address empty, the Kryspal apps still work, but they keep using the outside address and never switch to a direct connection at home. Enter http:// plus your NAS's LAN IP and the HTTP port, for example http://192.168.1.10:5797, in System settings → Network → LAN discovery address. If an app's check is refused, the Overview shows a card with the address the app used and a link to the field, already filled in.
Extras you can add#
- Access from outside your network. The compose file already publishes port 5798 (
WAN) and setsEXTERNAL_HTTP_ADDR: ":5798". Forward only 5798 on your router. Everything that arrives on this port counts as outside your network. We do not use 8920 because it clashes with Emby's HTTPS port when both run on one machine. - NAS file permissions. If your NAS uses file ACLs (for example Synology), add
user: "<uid>:<gid>"to the server, using the owner of your media files (id -uandid -g). - A bigger database memory setting. On a host with plenty of memory you can add a
command:to thepostgresservice to raise PostgreSQL's memory settings.
Use your own PostgreSQL#
PostgreSQL 16 to 18 are supported. We recommend our database image: it includes the pg_bigm extension, which makes short Chinese and Japanese searches faster. The official postgres image works fully too: without pg_bigm, search switches to pg_trgm automatically, which is just as fast for words of three characters or more, and a little slower only for one- or two-character Chinese or Japanese words in a very large library.
Create a database and a user for Kryspal Media, remove the postgres service, the pgdata and db volumes, and the server's depends_on and db volume line, then add an environment: section to the server with DATABASE_URL set to your own connection string, for example postgres://user:password@db.example:5432/kryspal?sslmode=disable. The server creates its tables on first start. To use pg_bigm, an account with enough privileges must run CREATE EXTENSION pg_bigm beforehand.
If the database cannot be reached by the name postgres, for example on a platform such as Unraid where containers on the default bridge network cannot find each other by name, publish a port on the database container and set DB_HOST to the NAS's IP address and DB_PORT to the published port in the server's environment: section. Without DATABASE_URL the server builds the connection address from the password file, and these two set its host and port; the defaults are postgres and 5432. They have no effect when DATABASE_URL is set.
Automated deployments#
If you deploy by script and do not want the wizard, add INITIAL_ADMIN_PASSWORD to the server's environment: section. When the database has no members yet, the server creates the administrator at startup and the setup wizard is skipped. If you leave it out, the wizard runs.
The server keeps restarting and the log says "the data directory does not match this database"#
At start-up the server checks that the server identity and keys in the data volume are the same ones the database has on record. If they differ, it refuses to start, the container restarts over and over, and the log shows this line: the data directory does not match this database.
- First check that the
datavolume is mounted. The most common cause is a NAS that mounts an external or network disk later than the container starts, so the server sees an empty folder. Once the disk is mounted, restart the container:docker compose restart server. - Only if you changed the keys or the data folder on purpose, accept the change: add
ACCEPT_DATA_DIR_CHANGE: "true"to the server'senvironment:section and start it once. After it starts successfully, remove that line.
After a NAS or Docker restart, Kryspal Media will not open#
The log keeps showing database not ready … lookup postgres … or cannot resolve the database host. From 0.9.15 the server prints the fix itself.
Cause. The container failed to start once. The most common reason is an older compose file that publishes 7359/udp and clashes with Emby or Jellyfin on the same machine. After that, Docker no longer reconnects it to its own network.
Fix. In the install folder, run:
docker compose up -d --force-recreate server
If the compose file still has the 7359/udp line, delete it first. On the bridge network it has no effect; automatic discovery needs the host network (see Automatic discovery above). Upgrading to 0.9.15 with install.sh does this step for you.