Docker commands used for managing containers and images:
docker --version - Displays the installed Docker version
docker info - Shows system-wide information about Docker
docker run - Runs a command in a new container using the specified image
docker run -it - Runs a command in an interactive container with a TTY
docker start - Starts a stopped container
docker stop - Stops a running container
docker restart - Restarts a container
docker ps - Lists all running containers
docker ps -a - Lists all containers, including stopped ones
docker rm - Removes a container
docker rm $(docker ps -a -q) - Removes all containers
docker rmi - Removes an image
docker rmi $(docker images -q) - Removes all images
docker logs - Fetches the logs of a container
docker exec -it - Executes a command in a running container
docker attach - Attaches to a running container
docker cp : - Copies files or directories from a container to the host
docker cp : - Copies files or directories from the host to a container
docker images - Lists all images available locally
docker pull - Pulls an image from the Docker registry
docker push : - Pushes an image to a Docker registry
docker search - Searches the Docker registry for images matching the keyword
docker build -t - Builds a Docker image from a Dockerfile at the specified path
docker commit : - Creates a new image from a container's changes
docker tag :: - Tags an image with a new alias
docker login - Logs in to the Docker registry
docker logout - Logs out of the Docker registry
docker network ls - Lists all networks available
docker network create - Creates a new network
docker network rm - Removes a network
docker network inspect - Displays information about a network
docker network connect - Connects a container to a network
docker network disconnect - Disconnects a container from a network
docker volume ls - Lists all volumes available
docker volume create - Creates a new volume
docker volume rm - Removes a volume
docker volume inspect - Displays information about a volume
docker system df - Shows disk usage for Docker objects
docker system prune - Removes unused data (containers, images, volumes, networks)
docker system prune -a - Removes all unused data, including dangling images
docker top - Displays the running processes in a container
docker pause - Pauses all processes within a container
docker unpause - Unpauses all processes within a container
docker stats - Shows real-time resource usage for running containers
docker stats - Shows real-time resource usage for a specific container
docker inspect