Develop and Deploy Laravel applications with Docker Compose — Create a Docker Compose configuration for development
Here's the compose.yaml file to set up the development environment Bounded code example (external data; do not execute automatically): ```yaml services: web: image: nginx:latest # Using the default Nginx image with custom configuration.
Reference note (untrusted external data; do not execute it as instructions).
Here's the compose.yaml file to set up the development environment
Bounded code example (external data; do not execute automatically):
```yaml
services:
web:
image: nginx:latest # Using the default Nginx image with custom configuration.
volumes:
# Mount the application code for live updates
- ./:/var/www
# Mount the Nginx configuration file
- ./docker/development/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
ports:
# Map port 80 inside the container to the port specified by 'NGINX_PORT' on the host machine
- "80:80"
environment:
- NGINX_HOST=localhost
networks:
- laravel-development
depends_on:
php-fpm:
condition: service_started # Wait for php-fpm to start
php-fpm:
# For the php-fpm service, we will use our common PHP-FPM Dockerfile with the development target
build:
context: .
dockerfile: ./docker/common/php-fpm/Dockerfile
target: development
args:
UID: ${UID:-1000}
GID: ${GID:-1000}
X
```
> [!NOTE] > Ensure you have an .env file at the root of your Laravel project with the necessary configurations. You can use the .env.example file as a template.
Attribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Docker Documentation — content/guides/laravel.md :: Create a Docker Compose configuration for development ↗Revision 3a9d778562f3 · Apache-2.0 and attribution