Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider bind mounting a directory instead of individual files #3142

Closed
muradbu opened this issue Apr 21, 2024 · 5 comments
Closed

Consider bind mounting a directory instead of individual files #3142

muradbu opened this issue Apr 21, 2024 · 5 comments
Labels

Comments

@muradbu
Copy link

muradbu commented Apr 21, 2024

Is your feature request related to a problem? Please describe.

Currently, the way to install Filebrowser with Docker is to create a bind mount for /srv, database.db and optionally .filebrowser.json:

volumes:
  - /home/murad/.config/filebrowser:/srv
  - /home/murad/.config/filebrowser/database.db:/database.db
  - /home/murad/.config/filebrowser/.filebrowser.json:/.filebrowser.json

This comes with a couple issues, of which one is already documented:

If you don't already have a database file, make sure to create a new empty file under the path you specified. Otherwise, Docker will create an empty folder instead of an empty file, resulting in an error when mounting the database into the container.

The other issue I'm running against is when editing .filebrowser.json on the host, the changes are not reflected in the container.

After further investigation, the cause seems to be related to inodes mismatching between host and container.

You can see that after creating the container, the inodes are similar:

ls -i .config/filebrowser/.filebrowser.json
275438 .config/filebrowser/.filebrowser.json

docker exec -it filebrowser ls -i .filebrowser.json
275438 .filebrowser.json

But after editing .filebrowser.json the inodes mismatch, causing the bind mount to become invalid:

ls -i .filebrowser.json
275455 .filebrowser.json

docker exec -it filebrowser ls -i .filebrowser.json
275438 .filebrowser.json

And the contents of .filebrowser.json on the host and the container are not the same anymore.

Describe the solution you'd like

Instead of bind mounting specific files, bind mount a directory instead.

database.db and .filebrowser.json could live in their own directory, e.g. /config (to avoid mounting /).

Then in the docker-compose you'd only need to mount /config as so:

volumes:
  - /home/murad/.config/filebrowser:/srv
  - /home/murad/.config/filebrowser:/config

This would eliminate both issues: needing to manually create database.db and invalidating the bind mount.

Describe alternatives you've considered

I haven't tested it, but a temporary workaround could be to create /config in the container manually, and hardlinking database.db and .filebrowser.json and then mounting it like that instead.

Additional context

@geozeke
Copy link

geozeke commented Apr 21, 2024

Creating mount points instead of single files sounds like a great idea. It may end up being a breaking change, but collapsing to a single mount point, like this, would really simplify things:

svr
├── branding
│   └── img
│       ├── icons
│       │   ├── favicon-16x16.png
│       │   └── favicon-32x32.png
│       └── logo.svg
├── config
│   └── filebrowser.json
├── db
│   └── database.db
└── files
    ├── example.pdf
    ├── file1.txt
    └── ...

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label May 22, 2024
@muradbu
Copy link
Author

muradbu commented May 22, 2024

bump

@github-actions github-actions bot removed the Stale label May 23, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jun 22, 2024
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants