At GRRR, we use Docker for local development and more. This ensures development-production parity, and prevents a lot of manual configuration work.
Anatomy of a Docker command:
docker-compose -f docker-compose.testing.yml exec php php artisan clear:cache
- docker-compose You can run commands using
docker
, or usingdocker-compose
. Usually you will usedocker-compose
, since that is what we use. - -f docker-compose.testing.yml This is a flag passed to the
docker-compose
command. In this case we instruct it to use config filedocker-compose.testing.yml
. Usually optional, until you need something advanced. - exec php This executes a command on a running container named
php
. An alternative toexec
isrun
, which is used to run a command on a container that is not running, such asyarn build
on our conventionalbuilder
container.php
is not a command, but the name of the container. - php artisan clear:cache This is the command that you execute on the container. It's a PHP command, executed in this case on a container that is also named
php
.