Support the ongoing development of Laravel.io →
Installation

Is anybody else using Docker either with or instead of Vagrant for server provisioning?

I think it's great that Laravel has Homestead and Forge to help with provisioning, but Docker seems to be gaining a lot of momentum. It's a virtualisation platform that calls itself a "lightweight application runtime and packaging tool", and it's lighter than full hypervisor virtualisation because unlike VMs, Docker containers share the kernel and filesystem with the host.

If anybody wants to try it, I put together a Docker container with everything ready for running Laravel. It's a Ubuntu 14.04 image based on phusion/baseimage-docker. You can see what's in my image on Github.

Instructions:

  • you need a 64-bit Linux host with at least kernel version 3.8. A host in a VM is fine.

  • my instructions are tested on Ubuntu 14.04 64-bit.

  • first install Docker:

    curl -sSL https://get.docker.io/ubuntu/ | sudo sh

  • then fetch my Laravel-ready Docker container from Dockerhub:

    sudo docker pull larazest/base:1.0.0

  • install and prepare a fresh copy of Laravel in a directory on the host, for example ~/laravel-app (as you normally do)

  • then run the container (you might have to shut down any web server on your host if you want to use port 80):

    sudo docker run -d -p 80:80 -v ~/laravel-app:/share larazest/base:1.0.0 /sbin/my_init --enable-insecure-key

  • check everything is working by navigating to http://localhost in a browser on the host

  • if you need to connect to the container with SSH, follow the instructions in [phusion/baseimage-docker] (https://github.com/phusion/baseimage-docker).

  • the Docker user guide has further instructions for starting, stopping and otherwise managing containers.

Last updated 2 years ago.
0

I'm going to give this a try. I'm curious about docker. Would you say that performance is about the same as a standard vagrant / virtualbox setup? what version of PHP are you running?

Last updated 2 years ago.
0

Yes I'm moving away from Vagrant and going to use Ansible+Docker in the future. Great stuff

Last updated 2 years ago.
0

I really like the idea of Docker, and we are looking to start using it with a rewrite coming up so this is a wonderful post, the only downfall is this really only benefits users on a Linux development machine, for those of us developing on OS-X we would still have to use a VM with a Linux guest and install the docker containers in that virtualised environment, correct?

Last updated 2 years ago.
0

Docker make use of some advanced Linux kernel-features...so yes, for OSX you still need Vagrant. Why anybody would want to use OSX in the first place is beyond me though :) But, Vagrant is still a great tool!

Last updated 2 years ago.
0

I just wrote up a blog post about using Docker with Laravel with 5 new custom built Docker images specifically built for Laravel. Splitting up the processes into individual containers is best practice rather than running everything in one Docker container and SSH'ing into it.

http://www.dylanlindgren.com/docker-for-the-laravel-framework

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.