Skip to content

Permissions Issue After docker compose up --wait on Ubuntu (root-owned files causing Git + Composer errors) #872

@clevercodenl

Description

@clevercodenl

After running docker compose up --wait

several files and directories inside the project (including /app inside the php container) are created as root, not as my local user.
This leads to multiple problems:

  1. Git refuses to operate inside /app

The php container reports:


fatal: detected dubious ownership in repository at '/app'
To add an exception for this directory, call:

        git config --global --add safe.directory /app
  1. Composer fails to install dependencies
Composer is unable to resolve multiple dependencies due to missing Symfony packages that are not loaded correctly (likely caused by Git + permission issues):

Problem 1
    - Root composer.json requires runtime/frankenphp-symfony * -> satisfiable by runtime/frankenphp-symfony[0.1.0, 0.1.1, 0.2.0].
    - runtime/frankenphp-symfony[0.1.0, ..., 0.1.1] require symfony/dependency-injection ^5.4 || ^6.0 -> found symfony/dependency-injection[v5.4.0, ..., v5.4.48, v6.0.0, ..., v6.4.26] but these were not loaded, likely because it conflicts with another require.
    - runtime/frankenphp-symfony 0.2.0 requires symfony/dependency-injection ^5.4 || ^6.0 || ^7.0 -> found symfony/dependency-injection[v5.4.0, ..., v5.4.48, v6.0.0, ..., v6.4.26, v7.0.0, ..., v7.4.0] but these were not loaded, likely because it conflicts with another require.
  1. .env file cannot be found
grep: .env: No such file or directory
  1. Cannot open bin/console

Could not open input file: bin/console

Below you can see a screenshot of the docker container logs and the directory in host:

Image _Docker container logs_

Image

File directory

Expected Behavior

Files created during docker compose up --wait should be owned by the same user as the one running the command, or by UID/GID that matches the configured PHP container user (default: 1000:1000).

Git should not reject the repository due to ownership issues.

Composer should be able to install all dependencies successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions