Laravel & Dockerfile Deployment Issue on DigitalOcean App Platform

I am attempting to deploy a Laravel application using a Dockerfile on DigitalOcean’s App Platform, following the guidelines provided in this tutorial:

The Docker image builds successfully, but it fails to deploy.

Here is my Dockerfile:

# Use the official PHP runtime image as the base image
FROM php:8.2-fpm

# Set the working directory inside the container
WORKDIR /var/www/html

# Install system dependencies and PHP extensions
RUN apt-get update && apt-get install -y \
    libpng-dev \
    libjpeg-dev \
    libfreetype6-dev \
    libzip-dev \
    libmagickwand-dev \
    && docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install -j$(nproc) gd pdo pdo_mysql zip pcntl

# Install Composer globally
RUN curl -sS | php -- --install-dir=/usr/local/bin --filename=composer

# Install Node.js and npm
RUN apt-get install -y nodejs npm

# Copy the Laravel application files into the container
COPY . .

# Install Laravel dependencies
RUN composer install --no-interaction

# Run npm install and npm run build
RUN npm install
RUN npm run build

# Expose port 80 for Nginx

# Install and configure Nginx
RUN apt-get install -y nginx
RUN rm /etc/nginx/sites-available/default
COPY nginx.conf /etc/nginx/sites-available/default

# Start the PHP-FPM server
#another comment
CMD ["php-fpm"]


server {
    listen 80;

    root /var/www/html/public;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass php-fpm:80; # Use the name of your PHP-FPM service
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

Deploy Log looks like success, but labeled as “Deploy Error: Health Checks”:

NOTICE: fpm is running, pid 1 NOTICE: ready to handle connections

I attempted to deploy without Nginx, but I couldn’t configure the app entrypoint as “/public.”

I am feeling frustrated and overwhelmed. Bleeding from eyes. Any assistance would be greatly appreciated.

it’s laravel 10.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
October 25, 2023

Hi there,

Is there a specific reason to use a Dockerfile rather than the native PHP buildpack?

Deploying a Laravel application with Docker on the DigitalOcean App Platform can be a bit tricky, especially when you’re dealing with combined services like PHP-FPM and Nginx within the same container.

Based on the error, it seems the primary issue is related to health checks. The App Platform expects your application to respond to HTTP checks to ensure it’s healthy and running. Since you are using PHP-FPM as your primary command (CMD ["php-fpm"]), it doesn’t open a standard HTTP port that the App Platform can ping for a health check.

What you could do in this case is to use a service like supervisord for example so you could start multiple services in the same container.

To do that you can add this to your Dockerfile:

RUN apt-get install -y supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

Then create supervisord.conf:



command=nginx -g "daemon off;"

Then change the CMD in your Dockerfile:

CMD ["/usr/bin/supervisord"]

After that you have to modify the Nginx configuration to point to the PHP-FPM socket instead of the service name. Change the fastcgi_pass directive as follows:


And finally make sure the App Platform can reach your application for health checks. If you haven’t specified a custom health check path, it will default to /. Ensure that your application responds to a GET request at the root path with a 200 OK response.

An easier approach would be to use the native PHP buildpack which will take care of all this for you.



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel