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

Docker Cheat Sheet: Process Management Volumes & Ports

This cheat sheet provides concise summaries of common Docker commands for managing containers, images, volumes, ports, and Docker Compose. It includes commands for running, stopping, and deleting containers; building, pulling, and pushing images; creating and deleting volumes; mapping ports; and starting, stopping, and destroying Docker Compose resources. The cheat sheet acts as a quick reference guide for performing essential Docker tasks.
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)
485 views1 page

Docker Cheat Sheet: Process Management Volumes & Ports

This cheat sheet provides concise summaries of common Docker commands for managing containers, images, volumes, ports, and Docker Compose. It includes commands for running, stopping, and deleting containers; building, pulling, and pushing images; creating and deleting volumes; mapping ports; and starting, stopping, and destroying Docker Compose resources. The cheat sheet acts as a quick reference guide for performing essential Docker tasks.
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 Volumes & Ports


# Show all running docker containers # List volumes
docker ps docker volume ls

# Show all docker containers # Create a volume


docker ps -a docker volume create <volume>

# Run a container # Delete a volume


docker run <image>:<tag> docker volume rm <volume>

# Run a container and connect to it # Show volume metadata


docker run -it <image>:<tag> docker volume inspect <volume>

# Run a container and clean it up after exit # Delete all volumes not attached to a container
docker run --rm <image>:<tag> docker volume prune

# Run a container in the background # Mount a local directory to your container


docker run -d <image>:<tag> docker run -v <local_dir>:<container_dir> <image>

# Stop a container # Copy file or folder from a docker container to host machine
docker stop <container> docker cp <container>:<container_dir> <local_dir>

# Kill a container # Copy file or folder from local machine onto a container
docker kill <container> docker cp <local_dir> <container>:<container_dir>

# Map a local port to a docker instance


docker run -d -p 127.0.0.1:<local_port>:<docker_port> <image>
Images/Repository
# List available local images # List the ports a docker container is running on
docker image ls docker port <container>

# Search for docker images


docker search <image>
Troubleshooting
# Pull a docker image # Show the logs of a container
docker image pull <image> docker logs <container>

# Build an image with a dockerfile # Follow/tail the logs of a container


docker image build -t <image>:<tag> <run_directory> -f docker logs -f <container>
<dockerfile>
# Show timestamps on docker logs
# Login to a remote repository
docker logs -t <container>
docker login <repository>
# Show details/metadata of a container
# Push an image to your remotee repository
docker inspect <container>
docker image push <image>:<tag>
# Show a 'top' view of processes running on a container
# Remove a local docker image
docker top <container>
docker image rm <image>:<tag>
# Show a 'top' view of all docker containers
# Show metadata for an image
docker stats
docker image inspect <image>
# Show any files that have changed since startup
# Remove all unused docker images
docker diff <container>
docker image prune
# Connect to an already running container
docker attach <container>
Docker Compose
# Execute a command on a container
# Start your docker-compose defined resources in detached mode docker exec -it <container_id> /bin/bash
docker-compose up -d -f <docker_compose_yaml>
# Show docker system wide information
# Stop all docker-compose resources docker system info
docker-compose stop
# Show docker disk space used
# Destroy all docker-compose resources docker system df
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

# Pull latest docker-compose images


docker-compose pull

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy