mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
feat(docker): add to the rootless docker docs
This commit is contained in:
parent
6de074a976
commit
aa8fd6dbd1
@ -78,12 +78,17 @@ docker inspect [container_name]</code></pre>
|
|||||||
you may need to add a <code>TZ</code> environment variable with the <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">TZ identifier</a> of
|
you may need to add a <code>TZ</code> environment variable with the <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">TZ identifier</a> of
|
||||||
your local timezone.</p>
|
your local timezone.</p>
|
||||||
<h2>Rootless Docker Image</h2>
|
<h2>Rootless Docker Image</h2>
|
||||||
|
<aside class="admonition note">
|
||||||
|
<p>Please keep in mind that the data directory is at <code>/home/trilium/trilium-data</code> instead
|
||||||
|
of the typical <code>/home/node/trilium-data</code>. This is because a new
|
||||||
|
user is created and used to run Trilium within the rootless containers.</p>
|
||||||
|
</aside>
|
||||||
<p>If you would prefer to run Trilium without having to run the Docker container
|
<p>If you would prefer to run Trilium without having to run the Docker container
|
||||||
as <code>root</code>, you can use either of the provided Debian (default)
|
as <code>root</code>, you can use either of the provided Debian (default)
|
||||||
and Alpine-based images with the <code>rootless</code> tag. </p>
|
and Alpine-based images with the <code>rootless</code> tag. </p>
|
||||||
<p><em><strong>If you're unsure, stick to the “rootful” Docker image referenced above.</strong></em>
|
<p><em><strong>If you're unsure, stick to the “rootful” Docker image referenced above.</strong></em>
|
||||||
</p>
|
</p>
|
||||||
<p>Below are some commands to pull the rootless images:</p><pre><code class="language-text-x-sh"># For Debian-based image
|
<p>Below are some commands to pull the rootless images:</p><pre><code class="language-text-x-trilium-auto"># For Debian-based image
|
||||||
docker pull triliumnext/notes:rootless
|
docker pull triliumnext/notes:rootless
|
||||||
|
|
||||||
# For Alpine-based image
|
# For Alpine-based image
|
||||||
@ -111,14 +116,14 @@ TRILIUM_UID=$(id -u) TRILIUM_GID=$(id -g) docker-compose -f docker-compose.rootl
|
|||||||
# Specify a custom data directory
|
# Specify a custom data directory
|
||||||
TRILIUM_DATA_DIR=/path/to/your/data TRILIUM_UID=$(id -u) TRILIUM_GID=$(id -g) docker-compose -f docker-compose.rootless.yml up -d
|
TRILIUM_DATA_DIR=/path/to/your/data TRILIUM_UID=$(id -u) TRILIUM_GID=$(id -g) docker-compose -f docker-compose.rootless.yml up -d
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<h4><strong>Using Docker CLI</strong></h4><pre><code class="language-text-x-sh"># Build the image
|
<h4><strong>Using Docker CLI</strong></h4><pre><code class="language-text-x-trilium-auto"># Build the image
|
||||||
docker build -t triliumnext/notes:rootless -f apps/server/Dockerfile.rootless .
|
docker build -t triliumnext/notes:rootless -f apps/server/Dockerfile.rootless .
|
||||||
|
|
||||||
# Run with default UID/GID (1000:1000)
|
# Run with default UID/GID (1000:1000)
|
||||||
docker run -d --name trilium -p 8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:rootless
|
docker run -d --name trilium -p 8080:8080 -v ~/trilium-data:/home/trilium/trilium-data triliumnext/notes:rootless
|
||||||
|
|
||||||
# Run with custom UID/GID
|
# Run with custom UID/GID
|
||||||
docker run -d --name trilium -p 8080:8080 --user $(id -u):$(id -g) -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:rootless
|
docker run -d --name trilium -p 8080:8080 --user $(id -u):$(id -g) -v ~/trilium-data:/home/trilium/trilium-data triliumnext/notes:rootless
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<h3>Environment Variables</h3>
|
<h3>Environment Variables</h3>
|
||||||
<ul>
|
<ul>
|
||||||
@ -136,7 +141,7 @@ docker run -d --name trilium -p 8080:8080 --user $(id -u):$(id -g) -v ~/trilium-
|
|||||||
using</li>
|
using</li>
|
||||||
<li>You're setting both <code>TRILIUM_UID</code> and <code>TRILIUM_GID</code> to
|
<li>You're setting both <code>TRILIUM_UID</code> and <code>TRILIUM_GID</code> to
|
||||||
match the owner of the host directory</li>
|
match the owner of the host directory</li>
|
||||||
</ol><pre><code class="language-text-x-sh"># For example, if your data directory is owned by UID 1001 and GID 1001:
|
</ol><pre><code class="language-text-x-trilium-auto"># For example, if your data directory is owned by UID 1001 and GID 1001:
|
||||||
TRILIUM_UID=1001 TRILIUM_GID=1001 docker-compose -f docker-compose.rootless.yml up -d
|
TRILIUM_UID=1001 TRILIUM_GID=1001 docker-compose -f docker-compose.rootless.yml up -d
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<h3>Considerations</h3>
|
<h3>Considerations</h3>
|
||||||
@ -182,5 +187,4 @@ docker build --build-arg USER=myuser --build-arg UID=1001 --build-arg GID=1001 \
|
|||||||
<li><code>USER</code>: Username for the non-root user (default: trilium)</li>
|
<li><code>USER</code>: Username for the non-root user (default: trilium)</li>
|
||||||
<li><code>UID</code>: User ID for the non-root user (default: 1000)</li>
|
<li><code>UID</code>: User ID for the non-root user (default: 1000)</li>
|
||||||
<li><code>GID</code>: Group ID for the non-root user (default: 1000)</li>
|
<li><code>GID</code>: Group ID for the non-root user (default: 1000)</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p> </p>
|
|
@ -8521,191 +8521,184 @@
|
|||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "_help_YKWqdJhzi2VY",
|
"value": "OFXdgB2nNk1F",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 50
|
"position": 50
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "OFXdgB2nNk1F",
|
"value": "BlN9DFI679QC",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 60
|
"position": 60
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "BlN9DFI679QC",
|
"value": "vZWERwf8U3nx",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 70
|
"position": 70
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "vZWERwf8U3nx",
|
"value": "oPVyFC7WL2Lp",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 80
|
"position": 80
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "oPVyFC7WL2Lp",
|
"value": "GPERMystNGTB",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 90
|
"position": 90
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "GPERMystNGTB",
|
"value": "CoFPLs3dRlXc",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 100
|
"position": 100
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "CoFPLs3dRlXc",
|
"value": "AlhDUqhENtH7",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 110
|
"position": 110
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "AlhDUqhENtH7",
|
"value": "pKK96zzmvBGf",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 120
|
"position": 120
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "pKK96zzmvBGf",
|
"value": "WFGzWeUK6arS",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 130
|
"position": 130
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "WFGzWeUK6arS",
|
"value": "0ESUbbAxVnoK",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 140
|
"position": 140
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "0ESUbbAxVnoK",
|
"value": "J5Ex1ZrMbyJ6",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 150
|
"position": 150
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "J5Ex1ZrMbyJ6",
|
"value": "d3fAXQ2diepH",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 160
|
"position": 160
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "d3fAXQ2diepH",
|
"value": "MgibgPcfeuGz",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 170
|
"position": 170
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "MgibgPcfeuGz",
|
"value": "m523cpzocqaD",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 180
|
"position": 180
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "m523cpzocqaD",
|
"value": "9sRHySam5fXb",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 190
|
"position": 190
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "9sRHySam5fXb",
|
"value": "u3YFHC9tQlpm",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 200
|
"position": 200
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "u3YFHC9tQlpm",
|
"value": "R9pX4DGra2Vt",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 210
|
"position": 210
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "R9pX4DGra2Vt",
|
"value": "iRwzGnHPzonm",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 220
|
"position": 220
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "iRwzGnHPzonm",
|
"value": "BCkXAVs63Ttv",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 230
|
"position": 230
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "BCkXAVs63Ttv",
|
"value": "47ZrP6FNuoG8",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 240
|
"position": 240
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "47ZrP6FNuoG8",
|
"value": "KC1HB96bqqHX",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 250
|
"position": 250
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "KC1HB96bqqHX",
|
"value": "BFvAtE74rbP6",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 260
|
"position": 260
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "BFvAtE74rbP6",
|
"value": "bdUJEHsAPYQR",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 270
|
"position": 270
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "bdUJEHsAPYQR",
|
"value": "AxshuNRegLAv",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 280
|
"position": 280
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "AxshuNRegLAv",
|
"value": "81SGnPGMk7Xc",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 290
|
"position": 290
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "relation",
|
|
||||||
"name": "internalLink",
|
|
||||||
"value": "81SGnPGMk7Xc",
|
|
||||||
"isInheritable": false,
|
|
||||||
"position": 300
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "xWbu3jpNWapp",
|
"value": "xWbu3jpNWapp",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 310
|
"position": 300
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "label",
|
"type": "label",
|
||||||
|
@ -121,13 +121,16 @@ If you are having timezone issues and you are not using docker-compose, you may
|
|||||||
|
|
||||||
## Rootless Docker Image
|
## Rootless Docker Image
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Please keep in mind that the data directory is at `/home/trilium/trilium-data` instead of the typical `/home/node/trilium-data`. This is because a new user is created and used to run Trilium within the rootless containers.
|
||||||
|
|
||||||
If you would prefer to run Trilium without having to run the Docker container as `root`, you can use either of the provided Debian (default) and Alpine-based images with the `rootless` tag.
|
If you would prefer to run Trilium without having to run the Docker container as `root`, you can use either of the provided Debian (default) and Alpine-based images with the `rootless` tag.
|
||||||
|
|
||||||
_**If you're unsure, stick to the “rootful” Docker image referenced above.**_
|
_**If you're unsure, stick to the “rootful” Docker image referenced above.**_
|
||||||
|
|
||||||
Below are some commands to pull the rootless images:
|
Below are some commands to pull the rootless images:
|
||||||
|
|
||||||
```sh
|
```
|
||||||
# For Debian-based image
|
# For Debian-based image
|
||||||
docker pull triliumnext/notes:rootless
|
docker pull triliumnext/notes:rootless
|
||||||
|
|
||||||
@ -166,15 +169,15 @@ TRILIUM_DATA_DIR=/path/to/your/data TRILIUM_UID=$(id -u) TRILIUM_GID=$(id -g) do
|
|||||||
|
|
||||||
#### **Using Docker CLI**
|
#### **Using Docker CLI**
|
||||||
|
|
||||||
```sh
|
```
|
||||||
# Build the image
|
# Build the image
|
||||||
docker build -t triliumnext/notes:rootless -f apps/server/Dockerfile.rootless .
|
docker build -t triliumnext/notes:rootless -f apps/server/Dockerfile.rootless .
|
||||||
|
|
||||||
# Run with default UID/GID (1000:1000)
|
# Run with default UID/GID (1000:1000)
|
||||||
docker run -d --name trilium -p 8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:rootless
|
docker run -d --name trilium -p 8080:8080 -v ~/trilium-data:/home/trilium/trilium-data triliumnext/notes:rootless
|
||||||
|
|
||||||
# Run with custom UID/GID
|
# Run with custom UID/GID
|
||||||
docker run -d --name trilium -p 8080:8080 --user $(id -u):$(id -g) -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:rootless
|
docker run -d --name trilium -p 8080:8080 --user $(id -u):$(id -g) -v ~/trilium-data:/home/trilium/trilium-data triliumnext/notes:rootless
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -191,7 +194,7 @@ If you encounter permission issues with the data volume, ensure that:
|
|||||||
1. The host directory has appropriate permissions for the UID/GID you're using
|
1. The host directory has appropriate permissions for the UID/GID you're using
|
||||||
2. You're setting both `TRILIUM_UID` and `TRILIUM_GID` to match the owner of the host directory
|
2. You're setting both `TRILIUM_UID` and `TRILIUM_GID` to match the owner of the host directory
|
||||||
|
|
||||||
```sh
|
```
|
||||||
# For example, if your data directory is owned by UID 1001 and GID 1001:
|
# For example, if your data directory is owned by UID 1001 and GID 1001:
|
||||||
TRILIUM_UID=1001 TRILIUM_GID=1001 docker-compose -f docker-compose.rootless.yml up -d
|
TRILIUM_UID=1001 TRILIUM_GID=1001 docker-compose -f docker-compose.rootless.yml up -d
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user