Docker compose

docker-compose up --build
docker-compose up --remove-orphans -d

Stop all containers

docker stop $(docker ps -aq)

Remove all containers

docker rm $(docker ps -aq)

List images

docker images

See which containers are running

docker ps

See all containers, including non-running

docker ps -a

Delete all images

sudo docker rmi $(sudo docker images -q) --force

Copy file from container to host

docker cp <:containerId>:/file/path/within/container /host/path/target

Copy file from host to container

docker cp /host/path/target <:containerId>:/file/path/within/container

View container logs

sudo docker logs my-symf

View container logs via docker compose

docker-compose logs --follow --timestamps --tail="all" <service>

Run a php script inside a container

docker run --rm -v $(pwd):/app -w /app php:cli php hello.php

Get ip address of container

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container name>
sudo docker inspect <container name> | grep IPAddress

Command prompt into a container

sudo docker exec -it  bash
sudo docker exec -it wp-local-docker_phpfpm_1 /bin/sh -c "[ -e /bin/bash ] && /bin/bash || /bin/sh"
docker-compose exec --user www-data phpfpm bash