I started using docker for managing my environment and it is fantastic. No more worries about provisioning redis, laravel echo server, workers queue, blahblah blah, just make a suitable image for each process, use docker-compose to orchestrate them and your done. I may write on this topic someday.
If you need advices you can ask me.
I'm creating Shipping Docker which will go in-depth on teaching Docker for development and production.
There's a free mini-course on getting up and running for development (along with explanation of what's going on)!
Definitely sign on up there to get some extra videos and notified when it's out! (And of course coupons, blah blah blah)
Hey so anyone still wanting to use docker with Laravel, Here is one running PHP7.0, MySQL 5.7 and Nginx I have set up and use all the time.
https://github.com/michaelmano/Dockers ( you will not require these files. This is just the repo You will only require Docker installed )
You do not require any files except Docker installed.
If you are starting a new project from scratch this container will create a Laravel project in the path you provide it and update the .env to the dockers database details. If you have an existing project and you provide it the path it will not install Laravel but instead use your project.
If you destory your docker when you are finished the files will be left on your computer so you will not lose anything (except the database however if you are using migrations and seeders you should be fine - if you require the database I suggest you do a mysql dump before hand with the dockers exec command).
Creating a Container The command below will spin up a new docker container named my-project running on port 80, You can change this if you have multiple projects by altering the -p 80:80 to -p 8888:80 (8888 to any port you prefer).
docker run --name my-project -itd -v /path/of/project:/var/www -p 80:80 -P michaelmano/laravel
Running Commands on the Container
docker exec -it my-project /bin/bash -c "php artisan migrate"
or open a console in the container
docker exec -it my-project /bin/bash
Destroying a Container This will leave the project folder it was using so all files will be safe.
docker rm my-project -f
Checking the Container Status
docker ps -a
This will show the containers you have running and on which port however you can use dockers Kitematic which is a visual interface for this also.
Just an update to the above post. I have now added sqlite to the docker so testing is possible in memory with sqlite.
just update your phpunit.xml to the following around line 27. I will also do this automatically on install of a new project.
<env name="DB_CONNECTION" value="sqlite"/> <env name="DB_DATABASE" value=":memory:"/>