docker pull <image-name> # Pull an image from Docker Hub
docker images # List all local images
docker rmi <image-name-or-id> # Remove an image
docker build -t name:tag . # Build image from Dockerfile
docker push username/repo-name # Push image to Docker Hubdocker run <image-name> # Create and run a container
docker run -d <image-name> # Run in detach (background) mode
docker run -it <image-name> /bin/bash # Run in interactive mode
docker run --name myname <image-name> # Run with custom name
docker run -p 8080:3306 <image-name> # Run with port binding
docker run -e KEY=VALUE <image-name> # Run with environment variable
docker run -v volume:/path <image-name> # Run with volume mounted
docker run --network netname <image-name> # Run inside specific network
docker ps # List running containers
docker ps -a # List all containers
docker start <name-or-id> # Start a stopped container
docker stop <name-or-id> # Stop a running container
docker rm <name-or-id> # Remove a container
docker logs <name-or-id> # View container logs
docker exec -it <name> /bin/bash # Access container terminaldocker network ls # List all networks
docker network create <network-name> # Create a new network
docker network rm <network-name> # Remove a networkdocker volume ls # List all volumes
docker volume create <volume-name> # Create a named volume
docker volume prune # Remove unused anonymous volumesdocker compose -f file.yaml up -d # Start all containers from file
docker compose -f file.yaml down # Stop and remove all containersdocker login # Login to Docker Hub
docker logout # Logout from Docker HubToday's lecture covered a complete end-to-end overview of Docker concepts:
Docker is an essential tool, especially when working in large organizations and development teams.
Whether you are building applications in:
Docker can be used to containerize all of them in a consistent way.