Skip to content

A pretty simplified docker-compose work-flow that sets up a LEMP network of containers for local Laravel development.

Notifications You must be signed in to change notification settings

abdulrahman19/Laravel-docker-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏁 Laravel docker compose

A pretty simplified docker-compose work-flow that sets up a LEMP network of containers for local Laravel development.

Containers created with their versions and their ports (if used) are as follows:

  • nginx stable-alpine - :8080
  • phpmyadmin latest - :8081
  • mysql 8.0.19 - :3309
  • php 7.3-fpm-alpine - :9010
  • npm 13.7
  • composer latest
  • artisan

Folders structure

├── src
│   └── [Laravel Project]
└── volumes
    ├── mysql
    │   └── [MySQL Database Binaries]
    ├── nginx
    │   └── default.conf
    └── php
        └── php.ini

Usage

To get started, make sure you have Docker installed on your system, and then clone this repository.

Add your entire Laravel project to the src folder first, change artisan file permission to 775, then open a terminal and from this cloned respository's root run docker-compose up -d --build. Open up your browser of choice to http://localhost:8080 and you should see your Laravel app running as intended.

Use the following command templates from your project root, modifiying them to fit your particular use case:

  • docker-compose run --rm composer [composer commands]
  • docker-compose run --rm npm [npm commands]
  • docker-compose run --rm artisan [artisan commands]

You can stop containers by running docker-compose down.

MySQL Information

MYSQL_DATABASE: dev_laravel
MYSQL_USER: laravel_user
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root

feel free to change those values.

PHP Extensions List

  • redis
  • xdebug
  • mongodb
  • pdo
  • pdo_mysql
  • zip
  • tokenizer
  • bcmath
  • ctype
  • json
  • mbstring
  • xml
  • gd

Troubleshooting

If you faced this error while you try connecting your MySQL database SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client.

Please do the following:

docker exec -it mysql mysql -u root -p

Enter your password secret, then type this command in MySQL bash

ALTER USER 'user' IDENTIFIED WITH mysql_native_password BY 'password';

Exit, and that's all ... You are ready now 🔥

🌹 Acknowledgment

About

A pretty simplified docker-compose work-flow that sets up a LEMP network of containers for local Laravel development.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published