Skip to content

Instantly share code, notes, and snippets.

Last active Dec 19, 2018
What would you like to do?
Docker Project Setup with Vessel

Docker Project Setup with Vessel

For an in-depth Docker tutorial, see


Install docker on MacOS/Windows:

Install docker in project:

composer require shipping-docker/vessel
php artisan vendor:publish --provider="Vessel\VesselServiceProvider"
bash vessel init

For non-Laravel apps: the service provider just copies the files and subdirectories of the docker-files folder to your project (

Edit .env :


PHP version

Edit docker-compose.yml and add a tag to the app image so you store separate images:

image: vessel/app:php-7.x

Next edit the files in docker/app to use the PHP version. Or copy any backup configuration…

Install PHP extensions and other stuff via docker/app/Dockerfile

MySQL root user

If you don’t need an additional user except root, comment out these lines in the mysql section of docker-compose.yml. Reason: if DB_USERNAME is root, the container won't be started properly.



./vessel start

Edit PHP.ini

See the server’s ini file:

./vessel exec app php -—ini

Copy the ini files to the shared root folder:

./vessel exec app cp /etc/php/7.1/fpm/php.ini /var/www/html
./vessel exec app cp /etc/php/7.1/cli/php.ini /var/www/html

Move the files to ./docker/app/php/ or somewhere...

Then edit the docker-compose.yml file and add a volume to app:

 - .:/var/www/html
 - ./docker/app/php/fpm/php.ini:/etc/php/7.1/fpm/php.ini
 - ./docker/app/php/cli/php.ini:/etc/php/7.1/cli/php.ini

Then stop and start the containers (not restart):

./vessel stop
./vessel start

From now on, if you now make changes to the ini file, just restart:

./vessel restart


Stop containers and remove the app image (specify tag if needed):

./vessel stop && docker image rm vessel/app:php-7.1

To also remove database data, get the volume name and remove it:

docker volume ls
docker volume rm volume_name

Start and build:

./vessel start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment