Docker
Remove everything
Section titled “Remove everything”Destructive: removes all containers, images, unused networks and volumes, including database data.
docker rm -f $(docker ps -aq)docker system prune -a -fdocker volume prune -a -fPull all images again
Section titled “Pull all images again”docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -v '<none>' | sort -u | xargs -r -L1 docker pullNamed volume for database data
Section titled “Named volume for database data”Useful where bind mounts are slow or break permissions, e.g. on Windows.
services: db: image: mysql:8.4 environment: MYSQL_ROOT_PASSWORD: example volumes: - db:/var/lib/mysqlvolumes: db: {}PHP built-in server
Section titled “PHP built-in server”The server must listen on 0.0.0.0 inside the container, and the port must be published:
docker run --rm -it -p 127.0.0.1:8080:8080 -v "$PWD:/app" -w /app php:cli php -S 0.0.0.0:8080Compose shell helpers
Section titled “Compose shell helpers”dev() { docker compose exec dev "${@:-bash}"}
gander_dev() { docker run --rm -it -p "127.0.0.1:80:80" -v "$PWD:/www" "gander/dev:${1:-8.1}" "${2:-bash}"}dev opens a shell in the dev service, and dev pwd runs a command there.

