Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vincent15000's avatar

Composer / Git and problem installing docker packages

Hello,

On a Laravel project in production with docker, all worked fine until this week.

Suddenly the services soketi and nginx didn't want to run.

So I decided to restart docker, but it doesn't work better.

So I decided to delete all containers and recreatet them. But this way it fails while installing soketi and nginx with this error. In the installation steps, I have created a service to install the PHP dependencies with composer.

The repository at "/var/www/html" does not have the correct ownership and git refuses to use it:

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

	git config --global --add safe.directory /var/www/html

efcaf1d0bf64   composer:2                              "/docker-entrypoint.…"   21 minutes ago   Exited (2) 50 seconds ago

I have tried a fresh installation on the server, but I get the same error.

A collaborator has upgraded sudo apt-get upgrade last week, but the problem is only from yesterday. Can this upgrade be responsible for the problems ?

Can you guide me to find why it doesn't work anymore ? What should I check ?

Thanks for your answer.

V

0 likes
3 replies
vincent15000's avatar

The solution seems to be only executing the git config --global --add safe.directory /var/www/html command in the console.

Does somebody know what happened with git ?

Thanks for your answers.

sreeharshrajan's avatar

@vincent15000 In your Dockerfile add this command after

# Set working directory
WORKDIR /var/www/html 

# Configure git to not prompt for credentials
RUN git config --global --add safe.directory /var/www/html
1 like

Please or to participate in this conversation.