Home / Technology / All Docker Commands

All Docker Commands

docker --version: Check the Docker version.

docker help: Display help information for Docker.

Working with Images:

docker pull: Pull an image from a registry.
docker pull

docker images: List all images on the local system.

docker build: Build an image from a Dockerfile.
docker build -t .

docker rmi: Remove one or more images.
docker rmi

docker tag: Tag an image with a new name.
docker tag

Working with Containers:

docker run: Run a command in a new container.
docker run -it

docker ps: List all running containers.
docker ps

docker ps -a: List all containers, including stopped ones.
docker ps -a

docker start: Start one or more stopped containers.
docker start

docker stop: Stop one or more running containers.
docker stop

docker restart: Restart a container.
docker restart

docker rm: Remove one or more containers.
docker rm

docker logs: Fetch the logs of a container.
docker logs

docker exec: Run a command in a running container.
docker exec -it

Networking:

docker network ls: List all networks.
docker network ls

docker network create: Create a new network.
docker network create

docker network inspect: Display detailed information on one or more networks.
docker network inspect

docker network rm: Remove one or more networks.
docker network rm

Volumes:

docker volume ls: List all volumes.
docker volume ls

docker volume create: Create a new volume.
docker volume create

docker volume inspect: Display detailed information on one or more volumes.
docker volume inspect

docker volume rm: Remove one or more volumes.
docker volume rm

Docker Compose:

docker-compose up: Build, create, start, and attach to containers.
docker-compose up

docker-compose down: Stop and remove containers, networks, images, and volumes.
docker-compose down

docker-compose build: Build or rebuild services.
docker-compose build

docker-compose ps: List containers.
docker-compose ps

docker-compose exec: Execute a command in a running container.
docker-compose exec

Docker System Management:

docker system df: Show docker disk usage.
docker system df

docker system prune: Remove unused data.
docker system prune