Skip to content

Docker With File Browser#

What Is The File Browser?#

  • filebrowser provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit your files. It allows the creation of multiple users and each user can have its own directory. It can be used as a standalone app.
  • More information

Create File Browser With Docker#

  • Let's create a file name docker-compose.yml, then add scripts as below:
docker-compose.yaml
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
version: '3'
services:
  file-browser:
    image: filebrowser/filebrowser:latest
    container_name: file-browser
    environment:
      - PUID=$(id -u)
      - PGID=$(id -g)
    ports:
      - 7979:80
    volumes:
      - /home/duc/share/:/srv
      - ./filebrowser.db:/database.db
      - ./settings.json:/config/settings.json
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
  • Then run two commands below to create 2 empty files.
1
2
touch filebrowser.db
touch settings.json
  • In the environment, we have:
    • PUID=$(id -u): Retrieves the user ID (UID) of the current user on the host system to ensure the container has the correct permissions.
    • PGID=$(id -g) : Retrieves the group ID (GID) of the current user on the host system to ensure the container has the correct group permissions.
  • In the volumes, we have:
    • /home/duc/share/:/srv: Mounts the host directory /home/duc/share/ to /srv in the container, allowing file access through the File Browser UI.
    • ./filebrowser.db:/database.db: Mounts the local filebrowser.db file to /database.db in the container to persist the database between restarts.
    • ./settings.json:/config/settings.json: Mounts the local settings.json configuration file to /config/settings.json in the container to customize File Browser settings.
  • In the security_opt, we have:
    • no-new-privileges:true: Prevents the container from gaining additional privileges, even if it tries to do so, enhancing security by restricting privilege escalation.

Testing#

  • Now you can use command docker-compose up -d to start your File Browser server.
  • Then we can access browser at localhost:7979 and login to access the dashboard.

 #zoom

  • By default the username is admin and password is admin.
  • Next, we can test by upload a file and then you should see it in the shared folder.

 #zoom

 #zoom

  • If your machine has many drive, you can mount that drive to machine and use file browser to link with it. Then if you are using VPN like tailscale then you can access the file browser web page on any device and you can download and upload files from that drive.