For an in-depth Docker tutorial, see https://course.shippingdocker.com/
- MacOS: https://docs.docker.com/docker-for-mac/install/
- Windows: https://docs.docker.com/docker-for-windows/install/
https://github.com/shipping-docker/vessel
composer require shipping-docker/vessel
php artisan vendor:publish --provider="Vessel\VesselServiceProvider"
bash vessel initFor non-Laravel apps: the service provider just copies the files and subdirectories of the
docker-filesfolder to your project (https://github.com/shipping-docker/vessel/tree/master/docker-files).
APP_ENV=local
APP_PORT=8080
MYSQL_PORT=33060
DB_DATABASE=dbname
DB_USERNAME=root
DB_PASSWORD=root
Edit docker-compose.yml and add a tag to the app image so you store separate images:
image: vessel/app:php-7.xNext 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
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.
#MYSQL_USER: "${DB_USERNAME}"
#MYSQL_PASSWORD: "${DB_PASSWORD}"./vessel startSee the server’s ini file:
./vessel exec app php -—iniCopy 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/htmlMove the files to ./docker/app/php/ or somewhere...
Then edit the docker-compose.yml file and add a volume to app:
volumes:
- .:/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.iniThen stop and start the containers (not restart):
./vessel stop
./vessel startFrom now on, if you now make changes to the ini file, just restart:
./vessel restartStop containers and remove the app image (specify tag if needed):
./vessel stop && docker image rm vessel/app:php-7.1To also remove database data, get the volume name and remove it:
docker volume ls
docker volume rm volume_nameStart and build:
./vessel start