Ready-to-use Laravel 12 + PHP 8.5-FPM base image for rapid backend dev.
376
This repository provides a lightweight and ready-to-use Docker image for Laravel 12 running on PHP 8.5-FPM. It is designed to be a clean starting point for backend development, coming with all the essential PHP extensions required by Laravel.
pdo_mysql, mbstring, exif, pcntl, bcmath, gd, zipSince this image runs PHP-FPM, it needs to be paired with a web server like Nginx. The easiest way to spin up the environment is using Docker Compose.
docker-compose.ymlCreate a file named docker-compose.yml in your project root and paste the following configuration:
services:
app:
image: bennett8857/laravel-app-12-php8.5:v1
container_name: laravel_app
restart: unless-stopped
tty: true
volumes:
# Uncomment the line below to bind mount your local code for development:
# - ./src:/var/www
- app_data:/var/www
networks:
- laravel-net
web:
image: nginx:alpine
container_name: laravel_nginx
restart: unless-stopped
ports:
- "8000:80"
volumes:
- app_data:/var/www
- ./nginx/conf.d/:/etc/nginx/conf.d/
networks:
- laravel-net
depends_on:
- app
networks:
laravel-net:
driver: bridge
volumes:
app_data:
Create a folder structure nginx/conf.d/ and inside it, create a file named app.conf:
server {
listen 80;
index index.php index.html;
root /var/www/public;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass app:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
gzip_static on;
}
}
Run the following command to start the containers in the background:
docker compose up -d
Your Laravel application will now be available at http://localhost:8000.
1. Generate APP_KEY
If you are starting a new project or running this for the first time without a mapped .env, remember to copy .env.example to .env and generate a new application key:
docker exec -it laravel_app cp .env.example .env
docker exec -it laravel_app php artisan key:generate
2. SQLite Permissions
If you are using the default SQLite database and encounter a readonly database error, fix the permissions by running:
docker exec -it laravel_app chown -R www-data:www-data /var/www/database
docker exec -it laravel_app chmod -R 775 /var/www/database
Content type
Image
Digest
sha256:6305fe69e…
Size
254.9 MB
Last updated
7 months ago
docker pull bennett8857/laravel-app-12-php8.5:v1