docs: docker caveat with bind mounts

This commit is contained in:
Henrique Dias 2025-07-03 16:00:54 +02:00
parent e99e0b3028
commit b6394745a3
No known key found for this signature in database

View File

@ -32,37 +32,43 @@ File Browser is now up and running. Read some [first boot](#first-boot) for more
## Docker
File Browser is available as two different Docker images, which can be found on [Docker Hub](https://hub.docker.com/r/filebrowser/filebrowser).
File Browser is available as two different Docker images, which can be found on [Docker Hub](https://hub.docker.com/r/filebrowser/filebrowser): a [bare Alpine image](#bare-alpine-image) and an [S6 Overlay image](#s6-overlay-image).
=== "Alpine"
### Bare Alpine Image
The
```sh
docker run \
-v filebrowser_data:/srv \
-v filebrowser_database:/database \
-v filebrowser_config:/config \
-p 8080:80 \
filebrowser/filebrowser
```
```sh
docker run \
-v /path/to/srv:/srv \
-v /path/to/database:/database \
-v /path/to/config:/config \
-p 8080:80 \
filebrowser/filebrowser
```
Where `filebrowser_data`, `filebrowser_database` and `filebrowser_config` are Docker [volumes](https://docs.docker.com/engine/storage/volumes/), where the data, database and configuration will be stored, respectively. The default configuration and database will be automatically initialized.
The default user has PID 1000 and GID 1000. Please make sure that this user has access to the different mounted volumes. To change the user running inside the Docker image, you need to use the [`--user` flag](https://docs.docker.com/engine/containers/run/#user).
The default user that runs File Browser inside the container has PID 1000 and GID 1000. If, for one reason or another, you want to run the Docker container with a different user, please consult Docker's [user documentation](https://docs.docker.com/engine/containers/run/#user).
=== "s6 overlay"
> [!NOTE]
>
> When using [bind mounts](https://docs.docker.com/engine/storage/bind-mounts/), that is, when you mount a path on the host in the container, you must manually ensure that they have the correct **permissions**. Docker does not do this automatically for you. The host directories must be readable and writable by the user running inside the container. You can use the [`chown`](https://linux.die.net/man/1/chown) command to change the owner of those paths.
The `s6` image is based on LinuxServer and leverages the [s6-overlay](https://github.com/just-containers/s6-overlay) system for a standard, highly customizable image. It should be used as follows:
File Browser is now up and running. Read the ["First Book"](#first-boot) section for more information.
```shell
docker run \
-v /path/to/srv:/srv \
-v /path/to/database:/database \
-v /path/to/config:/config \
-e PUID=$(id -u) \
-e PGID=$(id -g) \
-p 8080:80 \
filebrowser/filebrowser:s6
```
### S6 Overlay Image
The `s6` image is based on LinuxServer and leverages the [s6-overlay](https://github.com/just-containers/s6-overlay) system for a standard, highly customizable image. It should be used as follows:
```shell
docker run \
-v /path/to/srv:/srv \
-v /path/to/database:/database \
-v /path/to/config:/config \
-e PUID=$(id -u) \
-e PGID=$(id -g) \
-p 8080:80 \
filebrowser/filebrowser:s6
```
Where:
@ -72,24 +78,7 @@ Where:
Both `settings.json` and `filebrowser.db` will automatically be initialized if they don't exist.
File Browser is now up and running. Read some [first boot](#first-boot) for more information.
> [!NOTE]
>
> The Alpine Docker image has breaking changes from v2.33.0, in order to address multiple issues that have continuously affected multiple users. The changes are as follows:
>
> - **User**: File Browser no longer runs as `root`, but as user with PID 1000 and GID 1000. You can still change this by using Docker's [`--user` flag](https://www.docker.com/blog/understanding-the-docker-user-instruction/).
> - **Volumes**: the volumes with the database and configuration are now aligned with the s6-overlay images. Instead of mounting the files themselves, which leads to frequent issues, you now mount the surrounding directory.
>
> Assuming you have a `database.db`, a `.filebrowser.json` and the data in `/data`, do the following:
>
> 1. Change the path of `database` in `.filebrowser.json` to `/database/filebrowser.db`
> 2. Rename `database.db` to `filebrowser.db`
> 3. Rename `.filebrowser.json` to `settings.json`
> 4. Put them in the same directory locally, let's say `/app/filebrowser/`
> 5. Change the permissions of both directories: `sudo chown -R 1000:1000 /app/filebrowser /data`
> 6. Mount with the flags `-v /app/filebrowser:/database -v /app/filebrowser:/config` - you can also choose to put them in separate directories, but it is not needed.
File Browser is now up and running. Read the ["First Book"](#first-boot) section for more information.
## First Boot