Skip to content

Conversation

mihaon
Copy link
Contributor

@mihaon mihaon commented Aug 10, 2025

The https://directus.io/docs/getting-started/create-a-project contains a docker-compose.yml which will cause a permissions error when trying to upload files via the admin panel just after first start. It happens because docker "bind mount" host directory (in contrast to named volumes) is not initialized with owner/permissions taken from inside the container directory.

But since from Docker Compose 2.30 it became possible to use a post-start hook to fix this problem - https://docs.docker.com/compose/how-tos/lifecycle/#post-start-hooks.

So quick fix for .yml might be:

services:
    directus:
        # ...
        volumes:
            - ./database:/directus/database
            - ./uploads:/directus/uploads
            - ./extensions:/directus/extensions
        post_start:
            - command: chown node:node /directus/database /directus/uploads /directus/extensions
              user: root
        # ...

P.S.: this can also be fixed by adding chown to the CMD in the Dockerfile (like postgres docker image does)

Fix owner/permissions problem
@mihaon mihaon requested a review from a team as a code owner August 10, 2025 14:32
Copy link

vercel bot commented Aug 10, 2025

@mihaon is attempting to deploy a commit to the Directus Team on Vercel.

A member of the Team first needs to authorize it.

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

Successfully merging this pull request may close these issues.

1 participant