Skip to content
Endkind edited this page Mar 9, 2025 · 8 revisions

Laravel Docker Template

This repository contains a Docker Compose configuration to run a Laravel application with PostgreSQL, Redis, Apache, Scheduler, and Queue.

Prerequisites

  • Docker
  • Docker Compose
  • An existing Laravel project

Versions

This repository offers different versions of the Docker Compose configuration for various web servers:

  • http: Apache server serving the Laravel application over HTTP only.
  • http and https: Apache server serving the Laravel application over both HTTP and HTTPS.
  • force https: Apache server serving the Laravel application over HTTPS only and redirecting HTTP requests to HTTPS.

Installation

For installation instructions for each version, see the corresponding links above.

Services

  • web: Apache server serving the Laravel application and migrating the database on each start.
  • db: PostgreSQL database.
  • redis: Redis server for caching and queues.
  • scheduler: Container for scheduled Laravel tasks.
  • queue: Container for Laravel queue processing.

Optional: Removing Scheduler and Queue

If you do not use the Scheduler and Queue in Laravel, you can remove these services from the docker-compose.yml file:

  1. Open the docker-compose.yml file.

  2. Remove the following sections:

    scheduler:
      # ...existing code...
    
    queue:
      # ...existing code...

Commands

  • To run a command in the web container:

    docker-compose exec web <command>
  • Example: Running Artisan commands:

    docker-compose exec web php artisan <command>

Useful Links

License

This project is licensed under the MIT License. For more information, see the LICENSE file.

Clone this wiki locally