This page is a collection of various Docker commands and resources. For more info, read the Docker Documentation. To learn what Docker is, the official Docker Overview is an excellent resource.


# list
docker ps -a
# stop all
docker stop $(docker ps -a -q)

# remove all
docker rm $(docker ps -a -q)

# connect to any container
docker-compose exec [SERVICE] sh

# use user www-data (82) for Nginx and PHP containers
docker-compose exec --user=82 php sh


# list
docker images -a

# remove image
docker rmi [IMAGE ID]

# remove dangling images
docker rmi $(docker images -q -f dangling=true)

# remove all images
docker rmi $(docker images -a -q)


# list
docker volume ls

# remove volume
docker volume rm [VOLUME NAME]

# remove all volumes
docker volume rm $(docker volume ls -q)

# remove dangling volumes (1.13+)
docker volume prune

Drupal Dev Environment

Drupal Composer project mounted as a volume in a Docker container. Features include Drush, Drupal Console, mailhog and phpMyAdmin. A Docker-sync configuration is available for OS X.

Docker Drupal Dev Environment – Drupal Composer

WordPress Dev Environment

This example documents a local development environment for WordPress using Docker and Docker Compose. Aside from making the container configuration easier to understand, Docker Compose coordinates the creation, start and stop of the containers used together in this environment.

Docker WordPress Dev Environment – Xdebug with VS Code