Image for latest Laravel on Bitnami/Minideb for rapid development by David Melara
113
This is a rapid development container, just run the code below and you are ready to go. You can create a new project or use your existing one.
I do this on my spare time, so if you appreciate my work and want to support me, you can do it via paypal.me
Run the next command, replace according your needs. After that, you can use docker start/stop.
Port: This is the port to access your laravel project, ex. 8000,8001,etc. You can access your project by going into localhost:port/
Directory: This is the volume directory for storing your laravel source code. If no project is found, composer will automatically create a new one, leaving you with a "src" directory where all your project files are stored. If you already have a project, then make sure to create a "src" directory inside your volume Directory and copy your existing project there.
Name: This is the name of your container, by giving different ports and names, you can have multiple containers for multiple projects.
docker run -d --tty -p Port:8000 -v Directory:/home/laravel/src --name Name davidsal/laravelCommon PHP modules are installed, including the ones for MySQL. If you wish to connect your laravel project to your MySQL DB running on your host, go to your SRC directory and edit your .env file. In my case I'm using a passwordless root user, and MySQL running on another container with the 3306 port exposed :
DB_CONNECTION=mysql
DB_HOST=172.17.0.1
DB_PORT=3306
DB_DATABASE=Your_Database
DB_USERNAME=root
DB_PASSWORD=
Why I'm using 172.17.0.1? Because it is my Gateway IP for docker containers, you can check yours by issuing ifconfig and looking for the docker0 interface. This IP is a direct reference to your HOST IP. I develop on Linux, not sure if this works the same on Windows/Mac.
Access the console: you can access it by issuing the next command:
docker exec -it <Container Name> /bin/bashSwitch to user laravel: php artisan serve is running under user laravel. To use php artisan switch to user laravel and go to /home/laravel/src/src/ This is your project directory.
su laravel
cd /home/laravel/src/srcEntry Script: This is the script being called when starting the container, nano is installed so you can modifiy it easily.
nano /home/laravel/Entry Owner is user laravel!Auto start on boot: If you need the container to start at machine boot, use the next code. For more restart flags, check the documentation at the next link
Start containers automatically
docker run -d --tty --restart always -p Port:8000 -v Directory:/home/laravel/src --name Name davidsal/laravelContent type
Image
Digest
Size
212.4 MB
Last updated
almost 7 years ago
docker pull davidsal/laravel