docker-flarum: Directory permissions: "The /flarum/app directory is not writable."
As of the latest version, I get the same permission errors as reported in #36 The full error I get is:
flarum | [INFO] First launch, installation...
flarum | Please fix the following errors before we can continue with the installation.
flarum | The /flarum/app directory is not writable.
flarum | Please chmod this directory and its contents to 0775.
flarum | [INFO] End of flarum installation
During the many tests I’ve done, it also complains about the /flarum/app/public/assets
directory.
I simplified the docker-compose.yml
file to the following:
version: '3'
services:
flarum:
image: flarum-git
container_name: flarum
environment:
- FORUM_URL=http://localhost:8888
- DB_PASS=xxxxxx
- DEBUG=true
- FLARUM_ADMIN_USER=admin
- FLARUM_ADMIN_PASS=xxxxxxx
- FLARUM_ADMIN_MAIL=xxxxxxxxxx
volumes:
- /flarum/app/public/assets
- /flarum/app/extensions
depends_on:
- flarum_mariadb
flarum_mariadb:
image: mariadb:10.2
container_name: flarum_mariadb
volumes:
- /var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=xxxxxxxxxx
- MYSQL_DATABASE=flarum
- MYSQL_USER=flarum
- MYSQL_PASSWORD=xxxxxxxx
I have noted that if I the stop it right after that error, remove the installed.txt
file and re-run docker-compose up
, it does work in some combinations of permissions on the volumes that I can not even remember exactly given that I have tried so many that I can’t recall!
I also tried setting the GID
and ID
variables to my host user’s value and chowning the volumes accordingly, to no avail.
Can anyone try and see if it’s possible to reproduce?
Pull this image, copy/paste the file above, change the image name to the one you pull, edit the environnment variables, run it with docker-compose up
, without -d to keep the logs foreground!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (9 by maintainers)
Commits related to this issue
- fix(): set chown before installation #38 — committed to mondediefr/docker-flarum by Magicalex 5 years ago
Sorry keep posting, but has anyone figured out a temporary solution to get this to run in docker? I couldnt get the tips mentioned in this thread to work. Anyone else have any working ideas? Is @Simon-L soultion still working? It seemed to fail for me
Good to know! Made some more tests: It seems the issue comes from the Dockerfile,
COPY rootfs /
runs after creation and chown of the/flarum/app
folder. COPY creates folders and files with ID and GID 0, writing over the files and folders that need to be writable.One easy fix is adding this line in Dockerfile after the first “COPY”:
COPY --chown=991:991 rootfs/flarum /flarum
This technically copies the content of this folder twice, except the second time has the right permissions and ownership.Can you try my fix with the image latest?