Installing Laravel with a Composer Container

Next we need to install Laravel, but since we’re trying to do things the Docker
way, we’ll use a Composer container and mounted volume to create the project.
Just run this command in your terminal to create a new Laravel project:

Configuring Laravel

Because we’re going to use Apache as our webserver and we want to connect to the
database container we just created, there is some custom configuration to set
up. First, create a .htaccess file at the root of your new Laravel
installation:

karllhughes/php-apache-mysql finally this is the name of the image we’re using
for this container. I put this image together for running PHP/Apache projects
with MySQL and all the required extensions.

There’s plenty more you can do with containers to improve your local Laravel
development process, but as you can see getting started is surprisingly easy.
With just a couple commands, we’ve got Laravel running and we didn’t even have
to install any additional software on our local machine.

Like this Post? Get My eBook for FREE!

Learn to build your first Dockerized PHP application.

In this book, PHP developers will learn everything they need to know to start building their applications on Docker, including: