Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
738 views1 page

Docker Cheat Sheet: Process Management Images/Repository

This cheat sheet provides concise summaries of common Docker commands for managing containers, images, volumes, ports, and troubleshooting. It includes commands for running, stopping, and listing containers, pulling and pushing images, creating and removing volumes, mapping ports, and using Docker Compose to define multi-container applications.

Uploaded by

Jay Jay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
738 views1 page

Docker Cheat Sheet: Process Management Images/Repository

This cheat sheet provides concise summaries of common Docker commands for managing containers, images, volumes, ports, and troubleshooting. It includes commands for running, stopping, and listing containers, pulling and pushing images, creating and removing volumes, mapping ports, and using Docker Compose to define multi-container applications.

Uploaded by

Jay Jay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Docker Cheat Sheet

Process Management Images/Repository


# Show all running docker containers # List available local images
docker ps docker images

# Show all docker containers # Search for docker images


docker ps -a docker search <image>

# Run a container # Pull a docker image


docker run <image>:<tag> docker pull <image>

# Run a container and connect to it # Build an image with a dockerfile


docker run -it <image>:<tag> docker build -t <image>:<tag> <run_directory> -f <dockerfile>

# Run a container in the background # Login to a remote repository


docker run -d <image>:<tag> docker login <repository>

# Stop a container # Push an image to your remotee repository


docker stop <container> docker push <image>:<tag>

# Kill a container # Remove a local docker image


docker kill <container> docker rmi <image>:<tag>

# Show metadata for an image


docker inspect <image>
Volumes & Ports
# List volumes # Remove all unused docker images
docker volume ls docker image prune

# Create a volume
docker volume create <volume>
Troubleshooting
# Delete a volume # Show the logs of a container
docker volume rm <volume> docker logs <container>

# Show volume metadata # Follow/tail the logs of a container


docker volume inspect <volume> docker logs -f <container>

# Delete all volumes not attached to a container # Show timestamps on docker logs
docker volume prune docker logs -t <container>

# Mount a local directory to your container # Show details/metadata of a container


docker run -v <local_dir>:<container_dir> <image> docker inspect <container>

# Copy file or folder from a docker container to host machine # Show a 'top' view of processes running on a container
docker cp <container>:<container_dir> <local_dir> docker top <container>

# Copy file or folder from local machine onto a container # Show a 'top' view of all docker containers
docker cp <local_dir> <container>:<container_dir> docker stats

# Map a local port to a docker instance # Show any files that have changed since startup
docker run -d -p 127.0.0.1:<local_port>:<docker_port> <image> docker diff <container>

# List the ports a docker container is running on # Connect to an already running container
docker port <container> docker attach <container>

# Execute a command on a container


docker exec -it <container_id> /bin/bash
Docker Compose
# Start your docker-compose defined resources in detached mode # Show docker system wide information
docker-compose up -d -f <docker_compose_yaml> docker system info

# Stop all docker-compose resources # Show docker disk space used


docker-compose stop docker system df

# Destroy all docker-compose resources


docker-compose down

# Show docker-compose processes


docker-compose ps

# Show docker-compose logs


docker-compose logs

# Show docker-compose resource consumption


docker-compose top

You might also like