Logo

dev-resources.site

for different kinds of informations.

TOP 10 TYPES OF DOCKER COMMANDS

Published at
1/13/2025
Categories
docker
devops
development
containers
Author
aadarsh-nagrath
Author
15 person written this
aadarsh-nagrath
open
TOP 10 TYPES OF DOCKER COMMANDS

Important Docker Commands -

1. Docker Installation and Version

  • docker --version – Displays the installed Docker version.
  • docker info – Provides detailed information about the Docker installation.

2. Container Management

  • docker run <image> – Creates and starts a container from an image.
  • docker run -d <image> – Runs a container in detached mode (in the background).
  • docker run -it <image> – Runs a container interactively with a terminal.
  • docker ps – Lists all running containers.
  • docker ps -a – Lists all containers (running and stopped).
  • docker stop <container_id> – Stops a running container.
  • docker start <container_id> – Starts a stopped container.
  • docker restart <container_id> – Restarts a container.
  • docker pause <container_id> – Pauses a running container.
  • docker unpause <container_id> – Unpauses a paused container.
  • docker exec -it <container_id> <command> – Executes a command in a running container (e.g., docker exec -it <container_id> bash).
  • docker attach <container_id> – Attaches to a running container.
  • docker rm <container_id> – Removes a container.
  • docker logs <container_id> – Shows the logs of a container.
  • docker inspect <container_id> – Provides detailed information about a container.

3. Image Management

  • docker images – Lists all available images on your local machine.
  • docker pull <image> – Pulls an image from a Docker registry (e.g., Docker Hub).
  • docker build -t <image_name>:<tag> <path> – Builds a Docker image from a Dockerfile.
  • docker rmi <image_id> – Removes an image.
  • docker tag <image_id> <new_image_name> – Tags an image with a new name.
  • docker push <image> – Pushes an image to a Docker registry (e.g., Docker Hub).

4. Networking

  • docker network ls – Lists all Docker networks.
  • docker network inspect <network_name> – Displays detailed information about a Docker network.
  • docker network create <network_name> – Creates a new Docker network.
  • docker network connect <network_name> <container_name> – Connects a container to a network.
  • docker network disconnect <network_name> <container_name> – Disconnects a container from a network.

5. Volume Management

  • docker volume ls – Lists all volumes.
  • docker volume create <volume_name> – Creates a new volume.
  • docker volume inspect <volume_name> – Displays detailed information about a volume.
  • docker volume rm <volume_name> – Removes a volume.

6. Docker Compose

  • docker-compose up – Starts all services defined in the docker-compose.yml file.
  • docker-compose up -d – Starts all services in detached mode.
  • docker-compose down – Stops and removes all containers, networks, and volumes defined in the docker-compose.yml file.
  • docker-compose logs – Displays logs for all services.
  • docker-compose ps – Lists the status of containers managed by Docker Compose.

7. System Cleanup

  • docker system prune – Removes unused data (containers, images, networks, and volumes).
  • docker container prune – Removes all stopped containers.
  • docker image prune – Removes all unused images.
  • docker volume prune – Removes all unused volumes.
  • docker network prune – Removes all unused networks.

8. Container and Image Searching

  • docker search <image_name> – Searches for images on Docker Hub.

9. Docker Hub Authentication

  • docker login – Logs in to Docker Hub.
  • docker logout – Logs out from Docker Hub.

10. Docker Info and Performance

  • docker stats – Displays real-time statistics for containers.
  • docker top <container_id> – Displays the running processes of a container.
  • docker diff <container_id> – Shows the changes made to the container's filesystem.

These commands cover a wide range of Docker functionalities and will help with container, image, volume, and network management.

containers Article's
30 articles in total
Favicon
Nextcloud on Raspberry Pi - Fedora + Podman Quadlets
Favicon
AIOpsΒ : Investigation par l’IA dans Kubernetes avec HolmesGPT, Ollama et RunPod …
Favicon
TOP 10 TYPES OF DOCKER COMMANDS
Favicon
Build Faster and Smarter with Containerized Development Environments
Favicon
Pods in Kubernetes: Lifecycle, Networking, and the Role of Sidecars.
Favicon
Desplegar un contenedor de Docker desde Azure Container Registry en una WebApp
Favicon
Containerizing a Django Web Application: Serving Static Pages with Docker
Favicon
Exploring Docker: The Revolutionary Tool for Modern Application Development
Favicon
Por que usar Docker?
Favicon
Podman 3 and Docker Compose - How Does the Dockerless Compose Work?
Favicon
Setting Up an NGINX Reverse Proxy with a Node.js Cluster Using Docker
Favicon
AWS ECR Made Easy: Securely Store and Manage Your Container Images
Favicon
Docker Hands-on: Learn Dockerfile, Container, Port Forwarding with Sample Flask Project
Favicon
How to create efficient containers
Favicon
How to create efficient container
Favicon
How to create effesient container
Favicon
Containerization Starter Kit: Basics, History, and Key Technologies
Favicon
πŸ“ Docker Images Cheat Sheet πŸš€
Favicon
Docker
Favicon
Scaling Made Simple: How Kubernetes Manages Workloads in the Cloud
Favicon
Rootless Containers: What They Are and Why You Should Use Them
Favicon
docker
Favicon
Exploring Kubernetes: A Step Ahead of Basics
Favicon
☸️ Kubernetes Architecture Deep Dive: Understanding the Control Plane and Worker Nodes
Favicon
Kubernetes for Beginners: Making Sense of Container Orchestration in DevOps πŸš€
Favicon
Building Your First Container with a HelloWorld Image using Docker CLI
Favicon
First Post: Want to great you by this insightful article about Docker History
Favicon
Understanding Kubernetes Volume Types (EmptyDir, ConfigMap, Secret, HostPath)
Favicon
Building a Kubernetes Operator: A Practical Guide
Favicon
Tackling CPU Throttling in Kubernetes for Better Application Performance

Featured ones: