Essential Docker Commands


List of common and frequently used essential Docker commands
.

Displays the version of Docker installed on your system

docker --version

Downloads a Docker image from the Docker registry

docker pull <image>

Creates and starts a new container from a specified Docker image

docker run <image>

Lists all running containers on your system

docker ps

Lists all containers, including both running and stopped ones

docker ps -a

Lists all Docker images available on your local system

docker images

Starts a stopped container by its ID or name

docker start <container_id>

Stops a running container by its ID or name

docker stop <ontainer_id>

Restarts a running container by its ID or name

docker restart <container_id>

Provides detailed information about a container or image

docker inspect <container_id>

Removes a stopped container from your system

docker rm <container_id>

Deletes a Docker image from your system

docker rmi <image_id>

Executes a command inside a running containe

docker exec <container_id> <command>

Displays the logs of a container

docker logs <container_id>

Attaches your terminal to a running container

docker network ls

Detach terminal from docker container

'Ctrl + P' and 'Ctrl + Q' at the same time

Lists all networks available on your Docker host

docker network ls

Lists all Docker volumes available on your system

docker volume ls

Cleans up unused containers, networks, images, and volumes
*** Use Extreme Caution ***

docker prune

Supported By Cosmos Hosting