DEV Community

Cover image for All Docker Commands
Sujith V S
Sujith V S

Posted on

1

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 <image-name>

docker images: List all images on the local system.

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

docker rmi: Remove one or more images.
docker rmi <image-name>

docker tag: Tag an image with a new name.
docker tag <source-image> <target-image>

Working with Containers:

docker run: Run a command in a new container.
docker run -it <image-name>

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 <container-id>

docker stop: Stop one or more running containers.
docker stop <container-id>

docker restart: Restart a container.
docker restart <container-id>

docker rm: Remove one or more containers.
docker rm <container-id>

docker logs: Fetch the logs of a container.
docker logs <container-id>

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

Networking:

docker network ls: List all networks.
docker network ls

docker network create: Create a new network.
docker network create <network-name>

docker network inspect: Display detailed information on one or more networks.
docker network inspect <network-name>

docker network rm: Remove one or more networks.
docker network rm <network-name>

Volumes:

docker volume ls: List all volumes.
docker volume ls

docker volume create: Create a new volume.
docker volume create <volume-name>

docker volume inspect: Display detailed information on one or more volumes.
docker volume inspect <volume-name>

docker volume rm: Remove one or more volumes.
docker volume rm <volume-name>

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 <service-name> <command>

Docker System Management:

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

docker system prune: Remove unused data.
docker system prune

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

While many AI coding tools operate as simple command-response systems, Qodo Gen 1.0 represents the next generation: autonomous, multi-step problem-solving agents that work alongside you.

Read full post

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post