Full Laravel production and development environment for Docker, based on the official image php:apache
.
It is recommended to use this docker image in your testing environment(amd64 or arm64, support Apple silicon), it contains git/jq/vim/nodejs/npm, and php extensions: gd/mysql/pgsql/redis/xdebug.
docker run -p 8000:80 -v $(pwd):/var/www/laravel laravelfans/laravel:11-dev
docker run -v $(pwd):/var/www/laravel -it laravelfans/laravel:10-dev bash
It is recommended to use Dockerfile
to build your own docker image in your production environment.
composer require --dev laravel-fans/docker
php artisan docker:publish
Then you will find Dockerfile
in your project, so you can build:
docker build -t laravel-demo .
docker run -it laravel-demo
docker run -p 8000:80 -e "APP_ENV=local" -e "DB_CONNECTION=sqlite" \
-e "APP_KEY=base64:L+3avOYCfuq8nnDpHs74+5Et3sx27TssucHQIyqfpDY=" \
-it laravel-demo
Feel free to change the Dockerfile
.