Skip to content

CWSPS154/docker-laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Laravel

Prerequisites

  • Docker
  • Docker Compose

Setup Instructions

  1. Clone the repository:
    git clone https://github.com/CWSPS154/docker-laravel.git
    cd docker-laravel
    cp compose/.env.example compose/.env #and make your changes
  2. Run the setup script:
    chmod +x setup.sh
    ./setup.sh
    chmod +x bin/*
  3. Access the application:
    • Laravel App: http://${DOMAIN}:${WEB_PORT}

Common Commands

  • Start the containers:
./bin/start
  • Stop the containers:
./bin/stop
  • Run Laravel Artisan commands: using ./bin/cli
./bin/cli migrate
  • Some other commands
./bin/composer #for installing composer packages

./bin/bash #for accessing docker app bash

./bin/restart #restart containers

./bin/rollback #if anything goes wrong you can rollback everything

./bin/status #to check container status

Troubleshooting

  • Permission Issues:

    Ensure that the storage and cache directories have the correct permissions:

    ./bin/cli sh -c "chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache && chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache"
  • Database Connection Issues:

    Verify that the database credentials in the .env file match the settings in compose/docker-compose.yml.

  • Ensure your user is part of the docker group:

    sudo usermod -aG docker $USER
    newgrp docker

About

Docker container setup for Laravel

Resources

Stars

Watchers

Forks

Packages

No packages published