{"id":23404710,"url":"https://github.com/muhalvin/laravel-docker-compose","last_synced_at":"2026-04-16T12:39:31.066Z","repository":{"id":269259095,"uuid":"906877445","full_name":"muhalvin/laravel-docker-compose","owner":"muhalvin","description":"This project demonstrates how to set up a Laravel application with Docker, providing a streamlined development environment using Docker Compose.","archived":false,"fork":false,"pushed_at":"2025-01-04T15:04:03.000Z","size":100,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T17:58:13.684Z","etag":null,"topics":["docker","docker-compose","laravel"],"latest_commit_sha":null,"homepage":"https://towardsdev.com/setting-up-a-laravel-11-with-docker-522eebbef82d","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muhalvin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-22T07:11:18.000Z","updated_at":"2025-01-04T15:04:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"ce266bef-57e0-45fb-a75c-2c8a018d093b","html_url":"https://github.com/muhalvin/laravel-docker-compose","commit_stats":null,"previous_names":["muhalvin/laravel-docker-compose"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhalvin%2Flaravel-docker-compose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhalvin%2Flaravel-docker-compose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhalvin%2Flaravel-docker-compose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhalvin%2Flaravel-docker-compose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muhalvin","download_url":"https://codeload.github.com/muhalvin/laravel-docker-compose/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247941718,"owners_count":21022037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","laravel"],"created_at":"2024-12-22T13:15:24.700Z","updated_at":"2026-04-16T12:39:26.016Z","avatar_url":"https://github.com/muhalvin.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Laravel Dockerized App\n\nThis project demonstrates how to set up a Laravel application with Docker, providing a streamlined development environment using Docker Compose.\n\n## Table of Contents\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Environment Variables](#environment-variables)\n- [Commands](#commands)\n- [Troubleshooting](#troubleshooting)\n\n## Prerequisites\n\nBefore getting started, make sure you have the following installed:\n\n- [Docker](https://www.docker.com/get-started)\n- [Docker Compose](https://docs.docker.com/compose/install/)\n\n## Installation\n\n### 1. Clone the repository\n\nStart by cloning the repository to your local machine.\n\n```bash\ngit clone https://github.com/muhalvin/laravel-docker-compose.git\ncd laravel-docker-compose\n```\n\n### 2. Build and start the containers\n\nRun the following command to build and start the Docker containers for your application:\n\n```bash\ndocker-compose up --build -d\n```\n\nThis will build the Docker images and start the services defined in the `docker-compose.yml` file (Laravel app, MySQL database, etc.).\n\n### 3. Install dependencies inside the container\n\nOnce the containers are running, you'll need to install Laravel's dependencies using Composer. Run:\n\n```bash\ndocker-compose exec app composer install\n```\n\n### 4. Set up environment variables\n\nCopy the example `.env` file to create your own `.env` file.\n\n```bash\ncp .env.example .env\n```\n\nAdjust the `.env` file settings to match your environment, especially for database connection settings.\n\n### 5. Run migrations\n\nRun the Laravel database migrations to set up your database:\n\n```bash\ndocker-compose exec app php artisan migrate\n```\n\n## Usage\n\nOnce the containers are up and running, your Laravel app should be accessible at:\n\n```bash\nhttp://127.0.0.1:8000\n```\n\nYou can use this URL to access the Laravel application in your browser.\n\n## Environment Variables\n\nYou can customize various settings for your Laravel app using the `.env` file. Below are some key environment variables:\n\n- `APP_NAME`: The name of your application.\n- `APP_ENV`: The environment the app is running in (local, production, etc.).\n- `APP_KEY`: The application encryption key (can be generated with `php artisan key:generate`).\n- `DB_CONNECTION`: The database connection (default is `mysql`).\n- `DB_HOST`: The database host (default is `db`, which matches the service name in Docker Compose).\n- `DB_PORT`: The database port (default is `3306`).\n\nExample `.env` configuration:\n\n```env\nAPP_NAME=LaravelDockerApp\nAPP_ENV=local\nAPP_KEY=base64:yourappkeyhere\nDB_CONNECTION=mysql\nDB_HOST=db\nDB_PORT=3306\nDB_DATABASE=laravel\nDB_USERNAME=root\nDB_PASSWORD=password\n```\n\n## Commands\n\nHere are some useful commands you can run inside the Docker container:\n\n- **Clear config cache**:\n\n  ```bash\n  docker-compose exec app php artisan config:clear\n  ```\n\n- **Run tests**:\n\n  ```bash\n  docker-compose exec app php artisan test\n  ```\n\n- **Access the app container**:\n\n  ```bash\n  docker-compose exec -it app bash\n  ```\n\n- **Stop and remove containers**:\n\n  To stop the containers, run:\n\n  ```bash\n  docker-compose down\n  ```\n\n  To remove containers, volumes, and networks:\n\n  ```bash\n  docker-compose down --volumes --remove-orphans\n  ```\n\n  Check resource used by docker:\n\n  ```bash\n  docker stats\n  ```\n\n## Troubleshooting\n\n- **Cannot connect to MySQL**: If you have issues connecting to the MySQL database, ensure the `DB_HOST` is set to `db` (the service name defined in `docker-compose.yml`).\n\n- **Container not running**: If the container isn't running, check logs with:\n\n  ```bash\n  docker-compose logs app\n  ```\n\n- **Permission issues with `.env`**: Make sure the `.env` file has correct file permissions. If you encounter issues, run:\n\n  ```bash\n  chmod 644 .env\n  ```\n\n## Additional Information\n\nFor more details, check out this article: [Setting Up Laravel 11 with Docker](https://towardsdev.com/setting-up-a-laravel-11-with-docker-522eebbef82d)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhalvin%2Flaravel-docker-compose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuhalvin%2Flaravel-docker-compose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhalvin%2Flaravel-docker-compose/lists"}