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 init
For non-Laravel apps: the service provider just copies the files and subdirectories of the
docker-files
folder 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.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
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 start
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
:
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.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