How to use docker for old Laravel applications

Dr. Adam Nielsen
1 min readOct 11, 2023

For Laravel applications 8 or higher

sail is directly shipped. From here, I recommend to jump to the perfect documentation of Laravel

For Laravel version 5, 6 or 7

There is a package, that contains a minimal docker setup:

You can also checkout this video:

When upgrading from Laravel 7 to Laravel 8

I would recommend to install sail package using docker

docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/var/www/html \
-w /var/www/html \
laravelsail/php81-composer:latest \
composer install --ignore-platform-reqs

This allows you to install sail package, no matter what PHP or composer version you ahve.

Once you have this, I recommend to follow the instructions and beyond. From now on, you may always use PHP and composer from sail, so you again don’t need to worry about locally installed versions. Awesome :)