How to run trilium as rootless on server #8342
Replies: 4 comments 1 reply
-
|
Hi @podhorsky-ksj! I'm Dosu and I’m helping the Trilium team. To run Trilium rootless on a server with Podman Quadlet, you should use the rootless image (triliumnext/trilium:rootless or build it locally if not available). The standard image expects root privileges for UID/GID changes and will fall back to UID 1000 if you set USER_UID=0, causing permission mismatches with your host data directory. Running as root (UID 0) or using su inside the container is not supported in rootless mode and will fail or cause the data to be owned by the wrong user source. Here's what works:
This approach avoids root, aligns permissions, and works with Podman’s rootless defaults. If you hit permission errors, double-check the UID/GID on both host and container, and check logs for EACCES or ENOENT errors. To reply, just mention @dosu. Docs are dead. Just use Dosu. |
Beta Was this translation helpful? Give feedback.
-
|
I have issue with the build: |
Beta Was this translation helpful? Give feedback.
-
|
I also tried to get this working on Podman and ran into the same issues: when running Trilium Notes' container with my user in ~/.config/containers/systemd, even if I have I tried running rootful Podman changing to As I understand from your post, the fix would be some access or option to change the user running the data directory within the container. I wonder if there is a way for Podman to map all users (not just root) running within the container to a desired one on the host system. Edit: I somehow managed to get rootful Podman working with |
Beta Was this translation helpful? Give feedback.
-
|
I got it working to build my own container and run it with podman rootless. Don't forget to run the UID/GUID config: Here is my Dockerfile: place this into the cloned git folder of Trilium. This is the shellscript that builds the container, which is placed in the same folder as the cloned git folder: #!/usr/bin/env bash
cd Trilium
# https://stackoverflow.com/a/22857288
# Get new tags from remote
git fetch --tags
# check out to latest non beta version with some grep magic
latestTag=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
echo "[+] Checking out to Version \"$latestTag\""
# Checkout latest tag
git checkout $latestTag
VERSION=`jq -r ".version" package.json`
SERIES=${VERSION:0:5}-latest
echo "[+] Building container"
# Build from the repository
podman build -t triliumnext_selfbuilt/trilium:$VERSION -t triliumnext_selfbuilt/trilium:$SERIES .
echo "[+] Tagging built container"
if [[ $VERSION != *"beta"* ]]; then
podman tag triliumnext_selfbuilt/trilium:$VERSION triliumnext_selfbuilt/trilium:latest
fiSee also https://github.com/orgs/TriliumNext/discussions/7478 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
how to run trilium as rootless?
this manual seems to be outdated
https://docs.triliumnotes.org/user-guide/setup/server/installation/docker
I'm trying to run it on podman quadlet
But even this is not proper way. this is working, but /data are still under user node (uuid 1000), not under root, so they will show under different user than host user on host
When I try another uid and guid than 0, e.g. 1000 like the node, it will fail, bacause it doesn't have su priviledges.
Beta Was this translation helpful? Give feedback.
All reactions