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

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

Docker Essential Commands

The document provides a comprehensive list of essential Docker commands for managing images, containers, networks, and volumes. It includes commands for logging in and out of Docker registries, pulling and building images, running and managing containers, and using Docker Compose. Additionally, it covers system commands for monitoring disk usage and cleaning up unused data.

Uploaded by

Reddy dba
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)
8 views1 page

Docker Essential Commands

The document provides a comprehensive list of essential Docker commands for managing images, containers, networks, and volumes. It includes commands for logging in and out of Docker registries, pulling and building images, running and managing containers, and using Docker Compose. Additionally, it covers system commands for monitoring disk usage and cleaning up unused data.

Uploaded by

Reddy dba
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 Essential Commands:

docker version # Show Docker version info


docker info # Display detailed system info
docker login # Log in to a Docker registry
docker logout # Log out from a Docker registry

docker pull <image> # Pull an image from Docker Hub


docker build -t <name>:<tag> . # Build an image from Dockerfile
docker images # List local Docker images
docker rmi <image-id> # Remove a Docker image

docker create <image> # Create container from image


docker run <image> # Run container from image
docker run -it <image> /bin/bash # Interactive terminal access
docker run -d <image> # Run container in background
docker run -p <host-port>:<container-port> # Map host port to container
docker run --name <name> <image> # Assign a name to the container

docker ps # List running containers


docker ps -a # List all containers (incl. stopped)
docker start <container-id> # Start a stopped container
docker stop <container-id> # Stop a running container
docker restart <container-id> # Restart a container
docker rm <container-id> # Remove a stopped container

docker exec -it <container-id> /bin/bash # Run command in running container


docker logs <container-id> # View container logs
docker cp <container-id>:<path> <host-path> # Copy file from container to host
docker cp <host-path> <container-id>:<path> # Copy file from host to container

docker network ls # List Docker networks


docker network create <network-name> # Create a custom network
docker network connect <network> <container> # Connect container to a network

docker volume ls # List Docker volumes


docker volume create <volume-name> # Create a volume
docker run -v <volume>:<path> <image> # Mount volume to container

docker inspect <container/image> # Show detailed info (JSON)


docker tag <image> <repo>:<tag> # Tag image for registry push
docker push <repo>:<tag> # Push image to Docker registry

docker compose up # Start services from docker-compose


docker compose down # Stop & remove docker-compose services
docker compose build # Build services from compose file

docker system df # Show disk usage by Docker


docker system prune # Clean up unused data (careful!)

You might also like