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

longestdrive's avatar

Laravel Sail - Docker crashed and PHP now won't restart

Hi I've been using Laravel Sail 8.2 v 1.29.2 set up for quite a while with few problems. However today the docker container crashed and I'm unable to get the container to restart properly:

The console shows:

2024-11-06 15:04:48,937 INFO Set uid to user 0 succeeded
2024-11-06T15:04:48.941238658Z 2024-11-06 15:04:48,940 INFO supervisord started with pid 1
2024-11-06T15:04:49.944031990Z 2024-11-06 15:04:49,943 INFO spawned: 'php' with pid 9
2024-11-06T15:04:50.560418393Z 2024-11-06 15:04:50,560 INFO exited: php (terminated by SIGSEGV (core dumped); not expected)
2024-11-06T15:04:51.562946318Z 2024-11-06 15:04:51,562 INFO spawned: 'php' with pid 10
2024-11-06T15:04:52.176911736Z 2024-11-06 15:04:52,176 INFO exited: php (terminated by SIGSEGV (core dumped); not expected)
2024-11-06T15:04:54.180043886Z 2024-11-06 15:04:54,179 INFO spawned: 'php' with pid 11
2024-11-06T15:04:54.786109361Z 2024-11-06 15:04:54,785 INFO exited: php (terminated by SIGSEGV (core dumped); not expected)
2024-11-06T15:04:57.791471610Z 2024-11-06 15:04:57,791 INFO spawned: 'php' with pid 12
2024-11-06T15:04:58.395553684Z 2024-11-06 15:04:58,395 INFO exited: php (terminated by SIGSEGV (core dumped); not expected)
2024-11-06T15:04:59.396364119Z 2024-11-06 15:04:59,396 INFO gave up: php entered FATAL state, too many start retries too quickly

I've shut down docker using the following:

sail stop
sail down --remove-orphans

then restarted it using sail up

The host machine is ubuntu 22

I've restarted the host machine a couple of times and restarted docker but no impact on restarting.

In my browser when I try and go to the site I get an error:

This site can’t be reached
The web page at http://localhost/ might be temporarily down or it may have moved permanently to a new web address.
ERR_SOCKET_NOT_CONNECTED

The mysql server is running and I'm able to access that data using both an app on my host machine and installed phpmyadmin within docker.

I'm unable to run any phpunit tests.

So the crash appears to have corrupted something - is this a case of re-installing docker?

Any advice appreciated

Thank you

0 likes
7 replies
LaryAI's avatar
Level 58

The issue you're experiencing with Laravel Sail and Docker seems to be related to a segmentation fault (SIGSEGV) in the PHP process within the Docker container. This can happen due to various reasons, such as corrupted files, incompatible extensions, or misconfigurations. Here are some steps you can take to troubleshoot and potentially resolve the issue:

  1. Check Docker Logs: Start by checking the Docker logs for more detailed error messages. This might give you more insight into what's causing the segmentation fault.

    docker logs <container_id>
    

    Replace <container_id> with the ID of your PHP container.

  2. Rebuild Containers: Sometimes, rebuilding the containers can resolve issues related to corrupted files or configurations.

    sail down --remove-orphans
    sail build --no-cache
    sail up
    
  3. Check PHP Extensions: Ensure that all PHP extensions required by your application are correctly installed and compatible. You can check the installed extensions by running:

    sail shell
    php -m
    

    Compare the list with your application's requirements.

  4. Inspect Dockerfile and docker-compose.yml: Review your Dockerfile and docker-compose.yml for any custom configurations that might be causing the issue. Ensure that there are no conflicting or incorrect settings.

  5. Update Docker and Sail: Ensure that both Docker and Laravel Sail are up to date. Sometimes, bugs in older versions can cause unexpected behavior.

    # Update Docker
    sudo apt-get update
    sudo apt-get upgrade docker-ce docker-ce-cli containerd.io
    
    # Update Sail
    composer require laravel/sail --dev
    
  6. Check for Core Dumps: If a core dump is generated, it might provide more information about the crash. Check your system's core dump settings and logs.

  7. Reinstall Docker: If none of the above steps work, you might consider reinstalling Docker. This is a more drastic step and should be done with caution, as it will remove all your containers and images.

    sudo apt-get remove docker docker-engine docker.io containerd runc
    sudo apt-get install docker-ce docker-ce-cli containerd.io
    
  8. Check System Resources: Ensure that your system has enough resources (CPU, RAM) allocated to Docker. Insufficient resources can sometimes cause unexpected behavior.

If the problem persists after trying these steps, consider reaching out to the Laravel community or forums with detailed logs and configurations for further assistance.

longestdrive's avatar

@LaryAI Sadly none of the above worked - I'm going to reinstall docker and see if that makes a difference :(

martinbean's avatar

@longestdrive You shouldn’t need to re-install Docker. I doubt Docker is the culprit here.

SIGSEGV is a segfault error. Try re-building the Docker containers (sail build --no-cache) and then starting them again (sail up -d).

Lumethys's avatar

you have a redundant ";" somewhere in your code.

syntax error will cause the webserver to crash, after which supervisord will detect and try to restart it, only for it to crash again because the cause of the crash is a syntax error.

too many crash and restart will cause the docker container to stop.

In short: nothing to do with docker or sail, you have syntax error in your code (missing { or }, missing colon,...)

longestdrive's avatar

Thanks @laryai, @martinbean and @lumethys.

It does appear to be a coding issue - really uncertain where but I rolled back some recent changes and it came to life again. I've not had this before - usually with an error I get a whoop message up or something similar but not in this case. Thank you

Lumethys's avatar

@longestdrive things like that happens to me quite frequently when i am in the middle of my coding and the IDE auto-save

Please or to participate in this conversation.