Docker file on a Debian Jessie with :
It does not respect the single process docker style but this is the best way to make dev happy 😄
You need first to pull the image via docker pull potsky/laravel, then run the image :
docker run \
-v /path/to/your/laravel/app:/app \
-v mysql:/var/lib/mysql \
-p 2780:80 \
-p 2722:22 \
-p 2790:1080 \
-ti \
potsky/laravel
Finally go to http://localhost:2780 on your computer.
Tools are :
On Windows, run
docker run --rm -v /c/Users/path/to/your/folder:/app -v mysql:/var/lib/mysql -p 2780:80 -p 2722:22 -p 2790:1080 -ti potsky/laravel
Simply exit from the shell to stop the container.
Laravel default queue is automatically executed in a background daemon via php /app/artisan queue:work redis --sleep=3 --tries=3
On MacOS, the default docker host IP address is 192.168.65.1. On other systems, you should set your computr address in file /etc/php/7.0/apache2/conf.d/20-xdebug.ini to use xdebug.
root.laravellaravellaravelIn your laravel .env file, you just have to use this :
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=laravel
And execute php artisan migrate to create database tables.
If you run the image in a container without the -v mysql:/var/lib/mysql option, then the volume will not persist between two runs.
If you run the image with the -v mysql:/var/lib/mysql option, the database will persist between two runs. To remove the storage, just execute composer volume rm mysql.
If you have deleted all containers, run docker volume prune to remove all orphan volumes.
In your laravel .env file, you just have to use this :
MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
ssh -l root -p 2722 localhost
Default root password is root.
Simply run ngrok http 80 and copy the forward address http://xxxxxxxx.ngrok.io. Give it to someone externaly and it will access to your webserver live.
Build the new image
docker build -t my_laravel .
Run the dev image
docker run --rm -v /path/to/your/laravel/app:/app -i -p 2780:80 -p 2722:22 -t my_laravel
Content type
Image
Digest
Size
707.9 MB
Last updated
over 7 years ago
docker pull acrimed/laravel