Containers
Run Container
Start a new container from an image.
Terminal
docker run -d -p 80:80 --name my-app nginxList Containers
List running containers.
Terminal
docker ps
# List all containers (including stopped)
docker ps -aStop Container
Stop a running container.
Terminal
docker stop <container_id_or_name>Remove Container
Remove a stopped container.
Terminal
docker rm <container_id_or_name>Logs
Fetch the logs of a container.
Terminal
docker logs -f <container_id_or_name>Exec
Run a command in a running container.
Terminal
docker exec -it <container_id_or_name> bashImages
Build Image
Build an image from a Dockerfile.
Terminal
docker build -t my-image:latest .List Images
List local images.
Terminal
docker imagesPull Image
Pull an image from a registry.
Terminal
docker pull nginx:latestRemove Image
Remove a local image.
Terminal
docker rmi <image_id_or_name>Networks
Create Network
Create a new network.
Terminal
docker network create my-networkList Networks
List networks.
Terminal
docker network lsConnect
Connect a container to a network.
Terminal
docker network connect my-network <container_name>Volumes
Create Volume
Create a new volume.
Terminal
docker volume create my-volumeList Volumes
List volumes.
Terminal
docker volume lsRemove Volume
Remove a volume.
Terminal
docker volume rm my-volumeDocker Compose
Start Services
Start services defined in docker-compose.yml.
Terminal
docker-compose up -dStop Services
Stop services.
Terminal
docker-compose downView Logs
View output from services.
Terminal
docker-compose logs -fSystem
Prune
Remove unused data (stopped containers, networks, dangling images).
Terminal
docker system pruneStats
Display a live stream of container(s) resource usage statistics.
Terminal
docker stats