Docker image to run Laravel projects
100K+
Docker image to run PHP (supporting Laravel) and Node projects.
This image it's for development. Optimize to use in production!
In the latest update, I changed the base image to php:alpine for size optimizing.
latest:
php 7.4.19
composer 2.0.13phpunit 9.5.4xdebug 3.0.4nodejs 15.10.0
npm 7.12.1yarn 1.22.10mssql (via dblib)mysqlpgsqlsqlitecurlexifgdldapmongodbdocker pull hitalos/laravel
dockerdocker run --name <container_name> -d -v $PWD:/var/www -p 80:80 hitalos/laravel
Where $PWD is the laravel installation folder.
docker-composeCreate a docker-compose.yml file in the root folder of project using this as a template:
web:
image: hitalos/laravel:latest
ports:
- 80:80
volumes:
- ./:/var/www
# If you don't want to use default 'artisan serve' command, edit and uncomment the line below.
# command: php -S 0.0.0.0:80 -t public public/index.php
Then run using this command:
docker-compose up
If you want to use a database, you can create your docker-compose.yml with two containers.
web:
image: hitalos/laravel:latest
ports:
- 80:80
volumes:
- ./:/var/www
links:
- db
environment:
DB_HOST: db
DB_DATABASE: dbname
DB_USERNAME: username
DB_PASSWORD: p455w0rd
DB_CONNECTION: [pgsql or mysql]
db:
image: [postgres or mysql]
environment:
# with mysql
MYSQL_DATABASE: dbname
MYSQL_USER: username
MYSQL_PASSWORD: p455w0rd
# with postgres
POSTGRES_DB: dbname
POSTGRES_USER: username
POSTGRES_PASSWORD: p455w0rd
Content type
Image
Digest
Size
178.1 MB
Last updated
over 5 years ago
docker pull hitalos/laravel