← BACK TO THE VAULT
CW // VAULT

DOCKER COMMANDS

Quick-reference Docker and Docker Compose commands for managing services on the server.

CONTAINER STATUS

Show Running Containers

This shows all of the running containers.

docker ps

Show All Containers

This includes stopped containers as well.

docker ps -a

Show Container Resource Usage

This shows live CPU and memory usage.

docker stats

View Container Logs

This shows output from a specific container.

docker logs container-name

CONTAINER CONTROL

Start a Container

This starts a container.

docker start container-name

Stop a Container

This stops a running container.

docker stop container-name

Restart a Container

This restarts a container.

docker restart container-name

DOCKER COMPOSE CONTROL

Start Services

Start a docker compose service.

docker compose up -d

Restart Services

This restarts a running docker compose service.

docker compose restart

Restart Services

This restarts a docker compose service.

docker compose restart

Show Compose Services

This lists all running docker compose services.

docker compose ps

CONTAINER CLEANUP

Remove a Stopped Container

Remove a stopped container

docker rm container-name

Remove an Image

Remove a Docker image from the local system.

docker rmi image-name

Remove Unused Docker Data

Remove unused Docker resources such as stopped containers, unused networks, dangling images, and build cache.

docker system prune

IMAGE MANAGEMENT

List Images

Show all docker images on the system.

docker images

Pull an Image

Install a docker image into the system.

docker pull image-name

Build an Image

Build an image from the Dockerfile in the current directory.

docker build -t image-name .

VOLUME MANAGEMENT

List Volumes

Show all docker volumes.

docker volume ls

Inspect a Volume

Drill into and examine a volume.

docker volume inspect volume-name

Remove a Volume

Remove a Docker volume that is no longer needed.

docker volume rm volume-name