Skip to main content

Command Palette

Search for a command to run...

🐳 All Docker Commands Explained with Examples (2026 Complete Reference)

A complete beginner-friendly Docker CLI guide covering containers, images, volumes, networks, Docker Compose, registries, debugging, Docker Buildx, Swarm, and useful real-world commands.

Updated
β€’49 min readβ€’View as Markdown
🐳 All Docker Commands Explained with Examples (2026 Complete Reference)
H
πŸ‘‹ Hi, I’m Hritik Ranjan β€” a B.Tech CSE student and a passionate tech enthusiast focused on Quality Engineering, AI/ML, Cybersecurity, and DevOps. πŸ’‘ I enjoy building and testing scalable, secure, and intelligent systems that solve real-world problems. My expertise and interests include: πŸ”Ή Quality Assurance & Testing Hands-on experience in manual and automation testing using Selenium & Java, ensuring high-quality and reliable applications. πŸ”Ή Artificial Intelligence & Machine Learning Exploring advanced algorithms and developing intelligent systems for practical use cases. πŸ”Ή Cybersecurity Focused on vulnerability assessment, security testing, and system hardening. πŸ”Ή Web Development Building responsive and user-friendly applications using modern technologies. πŸ”Ή Data Science Analyzing complex data to extract actionable insights. πŸ’Ό Key Projects: πŸš€ Blindness Detection System Applied computer vision techniques to detect blindness-related conditions. πŸš€ AI-Powered Rail Madad Enhancement Developed an intelligent complaint management system to improve railway customer service. πŸš€ Interactive Applications Built multiple projects like quiz apps, calculators, and productivity tools. 🌱 I’m continuously learning and improving my skills in DevOps, Cloud, and Automation to become a well-rounded engineer. 🀝 Open to collaborations, internships, and opportunities in QA, DevOps, AI/ML, and Cybersecurity. πŸ“« Let’s connect: hritikranjan1408@gmail.com

Docker is one of the most important technologies for modern software development, DevOps, cloud engineering, and CI/CD.

If you are learning DevOps, AWS, Kubernetes, CI/CD, or cloud computing, Docker is one of the tools you should become comfortable with.

But when beginners start learning Docker, one problem appears again and again:

There are so many Docker commands. Which command should I use, and when?

This guide is designed to solve that problem.

Instead of simply giving you a list of commands, we will understand:

  • What each Docker command does

  • Why we use it

  • When we should use it

  • Command syntax

  • Real-world examples

  • Important options

  • Common mistakes

  • Beginner tips

  • Docker Compose commands

  • Docker networking

  • Docker volumes

  • Docker image management

  • Docker registry commands

  • Docker Buildx

  • Docker Swarm

  • Troubleshooting commands

  • A final Docker cheat sheet

By the end of this article, you should be able to use the Docker CLI confidently in your development and DevOps projects.


πŸ“Œ Table of Contents

  1. What Is Docker?

  2. Docker Architecture in Simple Words

  3. Docker Command Syntax

  4. Check Docker Installation

  5. Docker Container Commands

  6. Docker Image Commands

  7. Docker Registry Commands

  8. Docker Logs and Debugging

  9. Docker Volume Commands

  10. Docker Network Commands

  11. Docker Container Interaction

  12. Docker File Copy Commands

  13. Docker Cleanup Commands

  14. Docker Commit, Export and Import

  15. Docker Compose Commands

  16. Docker Compose Example Project

  17. Docker Context Commands

  18. Docker Buildx Commands

  19. Docker Manifest Commands

  20. Docker Swarm Commands

  21. Docker Plugin Commands

  22. Useful Docker Filters

  23. Useful Docker Formatting Commands

  24. Common Docker Errors

  25. Docker Commands Beginners Should Memorize

  26. Docker Cheat Sheet

  27. Docker Learning Roadmap

  28. Conclusion


🐳 What Is Docker?

Docker is a platform used to build, package, distribute, and run applications inside containers.

A container packages an application together with the dependencies it needs to run.

For example, imagine your application requires:

Application
    +
Python
    +
Required Libraries
    +
Environment Variables
    +
System Dependencies

Docker allows you to package these requirements into an image and run that image as a container.

A simple way to remember the relationship is:

Dockerfile
     ↓
Docker Image
     ↓
Docker Container

Dockerfile

A Dockerfile contains instructions for creating an image.

Docker Image

An image is a reusable package/template containing the application and its required environment.

Docker Container

A container is a running instance of an image.


πŸ—οΈ Docker Architecture in Simple Words

A simplified Docker architecture looks like this:

                Docker CLI
                    |
                    ↓
              Docker Engine
                    |
          ---------------------
          |         |         |
       Images   Containers  Networks
                    |
                 Volumes

When you run:

docker run nginx

Docker approximately performs this flow:

Docker CLI
   ↓
Check local image
   ↓
Image not available?
   ↓
Pull image from registry
   ↓
Create container
   ↓
Start container

The Docker documentation describes docker run as creating and running a new container from an image; if the image is unavailable locally, Docker can pull it first.


πŸ’» Docker Command Syntax

Most Docker commands follow this pattern:

docker <command> <options> <arguments>

For example:

docker run -d -p 8080:80 nginx

Here:

docker       β†’ Docker CLI
run          β†’ command
-d           β†’ run in detached mode
-p            β†’ publish a port
8080:80      β†’ host:container port
nginx        β†’ image

You can get help for almost any Docker command using:

docker --help

Or:

docker run --help

Docker officially supports the --help option for displaying command-specific help.


1️⃣ Check Docker Installation

Before learning Docker commands, verify that Docker is installed.

Check Docker Version

docker --version

Example:

Docker version 28.x.x, build xxxxx

This tells you the installed Docker CLI version.


Detailed Docker Version

docker version

This can show information about both the Docker client and server/engine.

Use it when troubleshooting version compatibility.


Docker System Information

docker info

This provides information about the Docker environment.

It can include:

  • Containers

  • Images

  • Storage driver

  • Docker root directory

  • CPUs

  • Memory

  • Plugins

  • Server information

Useful when troubleshooting Docker.


Docker Help

docker --help

For a specific command:

docker run --help

2️⃣ Docker Container Commands

Containers are where your applications actually run.

Let's learn the most important container commands.


docker run

The most important Docker command for beginners.

docker run nginx

It creates and starts a new container from the nginx image.

If the image isn't available locally, Docker can pull it from a registry.


Run in Background

docker run -d nginx

-d means:

Detached mode

The container runs in the background.


Give the Container a Name

docker run --name my-nginx -d nginx

Now instead of using a random container name, you can use:

docker stop my-nginx

Docker supports custom container names through the --name option.


Map a Port

docker run -d -p 8080:80 nginx

The format is:

-p HOST_PORT:CONTAINER_PORT

So:

8080 β†’ Your computer
80   β†’ Container

You can then access:

http://localhost:8080

Run an Interactive Ubuntu Container

docker run -it ubuntu /bin/bash

Meaning:

-i β†’ interactive
-t β†’ terminal

Now you can work inside the Ubuntu container.


Run a Specific Image Version

docker run nginx:1.27

Here:

nginx β†’ image
1.27  β†’ tag

Avoid blindly relying on latest in production deployments when reproducibility matters.


docker create

Creates a container but does not start it.

docker create --name mycontainer nginx

Then start it:

docker start mycontainer

Think:

docker create β†’ Create
docker start  β†’ Start

While:

docker run β†’ Create + Start

docker start

Starts an existing stopped container.

docker start mycontainer

Important:

docker run

creates a new container.

docker start

starts an existing container.


docker stop

Stops a running container gracefully.

docker stop mycontainer

Example:

docker stop nginx-container

Use this when you want to shut down an application cleanly.


docker restart

Restarts a container.

docker restart mycontainer

Useful when a service needs to be restarted after a configuration change or temporary problem.


docker pause

Pauses all processes inside a container.

docker pause mycontainer

docker unpause

Resumes a paused container.

docker unpause mycontainer

docker kill

Forcefully stops a running container.

docker kill mycontainer

Use docker stop for normal shutdowns.

Use docker kill when the container is stuck or doesn't respond properly.


docker rm

Removes a container.

docker rm mycontainer

If the container is still running, Docker normally requires you to stop it first.

You can force removal:

docker rm -f mycontainer

⚠️ Be careful with -f.


docker rename

Renames a container.

docker rename old-name new-name

Example:

docker rename nginx-container web-server

docker wait

Waits until a container stops and then prints its exit code.

docker wait mycontainer

Useful in automation and scripts.


docker container prune

Removes all stopped containers.

docker container prune

Docker asks for confirmation before deleting them.


3️⃣ Docker Image Commands

An image is a package/template used to create containers.

Think:

Image
  ↓
Container

One image can be used to create many containers.


docker pull

Downloads an image from a registry.

docker pull nginx

Specific version:

docker pull nginx:1.27

Ubuntu:

docker pull ubuntu:24.04

docker images

Lists locally available images.

docker images

Example output:

REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
nginx        latest    abc123         2 days ago    190MB
ubuntu       24.04     xyz456         3 days ago    78MB

docker image ls

Modern object-oriented form of listing images:

docker image ls

It is equivalent to:

docker images

docker build

Builds an image from a Dockerfile.

Suppose your project contains:

myapp/
β”œβ”€β”€ Dockerfile
└── app.py

Build the image:

docker build -t myapp:1.0 .

Meaning:

-t myapp:1.0 β†’ image name and tag
.            β†’ current directory

Example Dockerfile

FROM python:3.12-slim

WORKDIR /app

COPY app.py .

CMD ["python", "app.py"]

Build:

docker build -t python-app:1.0 .

Run:

docker run python-app:1.0

docker rmi

Removes an image.

docker rmi nginx

Or:

docker rmi nginx:latest

Force removal:

docker rmi -f nginx

Be careful because removing an image can affect containers that depend on it.


docker image rm

Equivalent object-oriented form:

docker image rm nginx

docker tag

Creates another tag/reference for an image.

docker tag myapp:latest username/myapp:v1

This is commonly used before pushing an image to Docker Hub or another registry.


docker history

Shows the layers used to create an image.

docker history nginx

This can help you understand image construction and investigate image size.


docker inspect

Displays detailed information about Docker objects.

For an image:

docker image inspect nginx

For a container:

docker inspect mycontainer

The output is usually JSON.

It can contain information such as:

  • Environment variables

  • Network configuration

  • Mounts

  • IP addresses

  • Image configuration

  • Container state


docker save

Saves an image to a tar archive.

docker save -o myimage.tar myapp:latest

Useful when you need to transfer an image without directly pulling it from a registry.


docker load

Loads an image from a tar archive.

docker load -i myimage.tar

Typical workflow:

Machine A
   ↓
docker save
   ↓
myimage.tar
   ↓
Transfer file
   ↓
Machine B
   ↓
docker load

4️⃣ Docker Registry Commands

A registry stores Docker images.

Examples include:

  • Docker Hub

  • Amazon ECR

  • GitHub Container Registry

  • Google Artifact Registry

  • Azure Container Registry

  • Private registries


docker login

Log in to a container registry.

docker login

For a specific registry:

docker login registry.example.com

docker logout

Log out from a registry.

docker logout

docker search

Search Docker Hub for images.

docker search nginx

You can use it to discover available images.

Always verify image ownership and trust before using third-party images.


docker push

Push an image to a registry.

First tag your image:

docker tag myapp:latest username/myapp:latest

Then:

docker push username/myapp:latest

Typical workflow:

Build
  ↓
Tag
  ↓
Login
  ↓
Push
  ↓
Registry

5️⃣ Docker Logs and Debugging

Debugging is one of the most important Docker skills.


docker ps

Shows running containers.

docker ps

docker ps -a

Shows all containers, including stopped containers.

docker ps -a

This is one of the first commands you should use when a container isn't behaving as expected.


docker logs

View container logs.

docker logs mycontainer

Follow Logs

docker logs -f mycontainer

-f means follow.

It behaves similarly to:

tail -f

Show Last 100 Lines

docker logs --tail 100 mycontainer

Show Logs with Timestamps

docker logs -t mycontainer

docker top

Shows processes running inside a container.

docker top mycontainer

Useful for checking whether the expected application process is running.


docker stats

Displays live resource usage.

docker stats

It can show:

CPU %
Memory Usage
Memory %
Network I/O
Block I/O
PIDs

For a specific container:

docker stats mycontainer

docker port

Shows port mappings.

docker port mycontainer

Example:

80/tcp -> 0.0.0.0:8080

This means container port 80 is exposed through host port 8080.


docker diff

Shows filesystem changes made inside a container.

docker diff mycontainer

Useful when troubleshooting unexpected file changes.


docker events

Shows real-time Docker events.

docker events

You may see events such as:

container create
container start
container stop
network connect
image pull

Useful for troubleshooting and automation.


docker inspect

One of the most powerful debugging commands.

docker inspect mycontainer

For example, to find the container IP:

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mycontainer

docker system df

Shows Docker disk usage.

docker system df

This helps identify whether images, containers, volumes, or build cache are consuming disk space.


6️⃣ Docker Volume Commands

Containers are designed to be replaceable.

But application data often needs to survive container deletion.

This is where volumes are useful.

Container
    |
    ↓
Volume
    |
    ↓
Persistent Data

docker volume create

Create a volume:

docker volume create my_volume

docker volume ls

List volumes:

docker volume ls

docker volume inspect

Inspect a volume:

docker volume inspect my_volume

Use a Volume with a Container

docker run -d \
  --name mysql \
  -v mysql_data:/var/lib/mysql \
  mysql

Here:

mysql_data              β†’ Docker volume
/var/lib/mysql          β†’ Path inside container

If the container is removed, the named volume can remain.


docker volume rm

Remove a volume:

docker volume rm my_volume

⚠️ Removing a volume can permanently delete stored data.


docker volume prune

Remove unused volumes:

docker volume prune

Use this carefully.


7️⃣ Docker Network Commands

Containers often need to communicate with:

  • Other containers

  • The host

  • External services

  • Databases

  • APIs

Docker networking makes this possible.


docker network ls

List networks:

docker network ls

Typical default networks include:

bridge
host
none

docker network create

Create a custom network:

docker network create my_network

Run Container on a Network

docker run -d \
  --name web \
  --network my_network \
  nginx

docker network inspect

Inspect a network:

docker network inspect my_network

This can show connected containers and network configuration.


docker network connect

Connect an existing container to a network:

docker network connect my_network mycontainer

docker network disconnect

Disconnect:

docker network disconnect my_network mycontainer

docker network rm

Remove a network:

docker network rm my_network

docker network prune

Remove unused networks:

docker network prune

🧠 Container-to-Container Communication Example

Create a network:

docker network create app-network

Run Redis:

docker run -d \
  --name redis \
  --network app-network \
  redis

Run another container:

docker run -it \
  --network app-network \
  busybox

Inside the second container, redis can be used as the hostname because Docker's user-defined networks provide service/container name-based communication.


8️⃣ Interact With a Running Container

Sometimes you need to enter a container to troubleshoot it.

The most useful command is:

docker exec

docker exec

Run a command inside a running container.

docker exec mycontainer ls

Open a Bash Shell

docker exec -it mycontainer /bin/bash

If Bash isn't available:

docker exec -it mycontainer /bin/sh

Important:

-i β†’ interactive
-t β†’ terminal

Docker documents docker exec as executing a new command inside a running container.


Run One Command

docker exec mycontainer ls /app

Run as Root

docker exec -u root -it mycontainer sh

Set Working Directory

docker exec -w /app mycontainer pwd

docker attach

Attaches your terminal to a container's main process.

docker attach mycontainer

This is different from docker exec.

docker exec

Starts a new process inside the container.

docker attach

Connects to the container's existing main process.

For beginners, docker exec is generally the safer choice for interactive troubleshooting.


9️⃣ Copy Files Between Host and Container


docker cp

Copy a file from host to container:

docker cp app.conf mycontainer:/app/app.conf

Copy a file from container to host:

docker cp mycontainer:/app/log.txt ./log.txt

Copy a directory:

docker cp ./config mycontainer:/app/

Useful for:

  • Debugging

  • Retrieving logs

  • Moving configuration

  • Temporary file transfers

For production applications, prefer proper image builds, volumes, or configuration mechanisms instead of manually modifying running containers.


πŸ”Ÿ Docker Cleanup Commands

Docker can consume significant disk space.

Images, containers, volumes, networks, and build cache can accumulate over time.


docker container prune

Remove stopped containers:

docker container prune

docker image prune

Remove dangling images:

docker image prune

docker image prune -a

Remove unused images more aggressively:

docker image prune -a

Be careful because images you may want later can be removed.


docker network prune

Remove unused networks:

docker network prune

docker volume prune

Remove unused volumes:

docker volume prune

⚠️ Volumes may contain important application or database data.


docker system prune

Clean unused Docker resources:

docker system prune

docker system prune -a

More aggressive cleanup:

docker system prune -a

This can remove unused images in addition to stopped containers and unused networks.

Always review what you're deleting before running cleanup commands on important systems.


docker system df

Before cleaning, check usage:

docker system df

A good habit is:

Check
 ↓
docker system df
 ↓
Clean
 ↓
docker system prune

1️⃣1️⃣ Docker Commit, Export and Import

These commands are less common in modern application workflows but are useful to understand.


docker commit

Creates a new image from a container's changes.

docker commit mycontainer myimage:v1

For example:

Running Container
       ↓
Manual Changes
       ↓
docker commit
       ↓
New Image

However, for reproducible application builds, a Dockerfile is usually preferred.


docker export

Exports a container filesystem as a tar archive.

docker export mycontainer > backup.tar

Important distinction:

docker export exports a container filesystem.

It does not preserve the image's complete layer history.


docker import

Creates an image from a tar archive.

docker import backup.tar restored-image:latest

docker save vs docker export

This is a common interview question.

docker save

Used for images.

docker save -o image.tar myimage

docker export

Used for containers.

docker export mycontainer > container.tar

Remember:

IMAGE      β†’ docker save
CONTAINER  β†’ docker export

1️⃣2️⃣ Docker Compose Commands

Docker Compose is used to define and run multi-container applications.

For example:

Application
   |
   +--- Frontend
   |
   +--- Backend
   |
   +--- Database
   |
   +--- Redis

Instead of manually running every container, Compose allows you to define the application stack in a YAML file.

Docker's current documentation describes Compose as a tool for defining and running multi-container applications.

Modern Docker uses:

docker compose

rather than the older standalone:

docker-compose

docker compose up

Start the application stack:

docker compose up

Run in background:

docker compose up -d

docker compose down

Stop and remove Compose-managed containers and networks:

docker compose down

docker compose build

Build service images:

docker compose build

docker compose up --build

Build images and start services:

docker compose up --build

docker compose ps

Show Compose containers:

docker compose ps

Include stopped containers:

docker compose ps --all

The current Compose CLI supports --all to include stopped containers.


docker compose logs

Show logs:

docker compose logs

Follow logs:

docker compose logs -f

Specific service:

docker compose logs -f backend

docker compose exec

Run a command inside a service container:

docker compose exec web sh

For example:

docker compose exec db sh

Compose provides service-oriented execution, so you don't need to remember the generated container name.


docker compose pull

Pull service images:

docker compose pull

docker compose push

Push service images:

docker compose push

docker compose start

Start existing containers:

docker compose start

Important difference:

docker compose up

creates and starts containers when necessary.

docker compose start

starts existing containers.

Docker documents compose start specifically as starting existing service containers.


docker compose stop

Stop services:

docker compose stop

The containers remain available to start again.


docker compose restart

Restart services:

docker compose restart

docker compose rm

Remove stopped service containers:

docker compose rm

docker compose run

Run a one-time command for a service:

docker compose run web sh

Useful for:

  • Database migrations

  • Admin commands

  • One-time scripts

  • Debugging


docker compose config

Validate and render the Compose configuration:

docker compose config

This is very useful when debugging YAML, environment variables, or merged Compose files.


docker compose images

List images used by the Compose project:

docker compose images

docker compose top

Show processes running inside service containers:

docker compose top

docker compose stats

Show resource usage:

docker compose stats

docker compose port

Show the public port mapping for a service:

docker compose port web 80

docker compose ls

List Compose projects:

docker compose ls

docker compose --dry-run

Modern Docker Compose also supports dry-run mode for testing commands without applying stack changes.

Example:

docker compose --dry-run up --build -d

This is particularly useful when you want to understand what Compose plans to do before actually changing the environment.


1️⃣3️⃣ Real-World Docker Compose Example

Let's create a simple application with:

Web
Database

Create:

compose.yaml

Example:

services:

  web:
    image: nginx:alpine
    ports:
      - "8080:80"

  redis:
    image: redis:alpine

Start:

docker compose up -d

Check:

docker compose ps

View logs:

docker compose logs

Stop:

docker compose stop

Start again:

docker compose start

Remove the stack:

docker compose down

The current Compose Specification is the recommended Compose file format; older Compose 2.x and 3.x file formats were merged into the Compose Specification.


1️⃣4️⃣ Docker Context Commands

Docker contexts allow the CLI to work with different Docker endpoints.

For example:

Local Docker
      +
Remote Docker Server
      +
Cloud Environment

docker context ls

List contexts:

docker context ls

docker context show

Show the current context:

docker context show

docker context use

Switch context:

docker context use my-context

docker context create

Create a context.

For example, an SSH-based context:

docker context create remote-server --docker "host=ssh://user@server"

Then:

docker context use remote-server

Now Docker commands can target that context.

Switch back:

docker context use default

docker context inspect

Inspect a context:

docker context inspect remote-server

docker context rm

Remove a context:

docker context rm remote-server

1️⃣5️⃣ Docker Buildx Commands

Buildx provides advanced Docker image building capabilities.

It is especially useful for:

  • Multi-platform images

  • Advanced build workflows

  • CI/CD

  • Build cache

  • Modern Docker builds


docker buildx ls

List builders:

docker buildx ls

docker buildx create

Create a builder:

docker buildx create --name mybuilder

Use it:

docker buildx use mybuilder

docker buildx inspect

Inspect a builder:

docker buildx inspect mybuilder

docker buildx build

Build an image:

docker buildx build -t myapp:latest .

Multi-Architecture Build

Build for AMD64 and ARM64:

docker buildx build \
  --platform linux/amd64,linux/arm64 \
  -t username/myapp:latest \
  --push .

This is useful when your application needs to run on different CPU architectures.

For example:

Intel/AMD servers
        +
ARM servers
        ↓
Same Docker image tag

1️⃣6️⃣ Docker Manifest Commands

Manifests help work with image manifests and multi-platform image references.


docker manifest inspect

Inspect a manifest:

docker manifest inspect nginx:latest

This can show information about supported platforms.


docker manifest create

Create a manifest list:

docker manifest create \
  myapp:latest \
  myapp:amd64 \
  myapp:arm64

docker manifest push

Push a manifest list:

docker manifest push myapp:latest

For most modern multi-platform build workflows, Buildx is generally the simpler approach.


1️⃣7️⃣ Docker Swarm Commands

Docker Swarm is Docker's native clustering/orchestration technology.

Kubernetes is more commonly encountered in modern cloud-native environments, but understanding Swarm is useful for Docker knowledge and interviews.


docker swarm init

Initialize a Swarm:

docker swarm init

If you need to specify the advertised address:

docker swarm init --advertise-addr 192.168.1.10

docker swarm join

Workers can join using the command generated by the manager:

docker swarm join --token <TOKEN> <MANAGER-IP>:2377

docker node ls

List nodes:

docker node ls

docker node inspect

Inspect a node:

docker node inspect node-name

docker node ps

Show tasks running on a node:

docker node ps node-name

docker service create

Create a service:

docker service create \
  --name web \
  --replicas 3 \
  nginx

This creates a service with three replicas.


docker service ls

List services:

docker service ls

docker service ps

Show service tasks:

docker service ps web

docker service scale

Scale a service:

docker service scale web=5

Now:

web
 ↓
5 replicas

docker service update

Update a service:

docker service update --image nginx:latest web

docker service rm

Remove a service:

docker service rm web

docker stack deploy

Deploy a stack using a Compose file:

docker stack deploy -c compose.yaml myapp

docker stack ls

List stacks:

docker stack ls

docker stack services

List services in a stack:

docker stack services myapp

docker stack ps

Show tasks in a stack:

docker stack ps myapp

docker stack rm

Remove a stack:

docker stack rm myapp

1️⃣8️⃣ Docker Plugin Commands

Docker plugins can extend Docker functionality.


docker plugin ls

List plugins:

docker plugin ls

docker plugin install

Install a plugin:

docker plugin install <plugin>

Only install plugins from sources you trust and understand.


docker plugin enable

Enable a plugin:

docker plugin enable <plugin>

docker plugin disable

Disable:

docker plugin disable <plugin>

docker plugin inspect

Inspect:

docker plugin inspect <plugin>

docker plugin rm

Remove:

docker plugin rm <plugin>

1️⃣9️⃣ Useful Docker Filters

Docker provides filtering options for many commands.


Find Containers by Status

docker ps -a --filter status=exited

Find Containers by Name

docker ps --filter name=web

Find Containers by Ancestor Image

docker ps --filter ancestor=nginx

Show Only Container IDs

docker ps -q

This is extremely useful in shell scripts.

Example:

docker stop $(docker ps -q)

2️⃣0️⃣ Useful Docker Formatting Commands

Docker supports output formatting using Go templates.

For example:

docker ps --format "{{.Names}}"

Show container names and status:

docker ps --format "table {{.Names}}\t{{.Status}}"

Show image names:

docker images --format "{{.Repository}}:{{.Tag}}"

This is useful in:

  • Shell scripting

  • Automation

  • CI/CD pipelines

  • Monitoring scripts


2️⃣1️⃣ Common Docker Errors

Let's look at some problems beginners frequently face.


❌ Error: Docker Daemon Is Not Running

You may see an error similar to:

Cannot connect to the Docker daemon

First check:

docker info

On Linux with systemd:

sudo systemctl status docker

Start Docker:

sudo systemctl start docker

Enable Docker at boot:

sudo systemctl enable docker

❌ Error: Container Name Already in Use

Example:

Conflict. The container name is already in use.

Check:

docker ps -a

Then remove the old container:

docker rm old-container

Or choose another name:

docker run --name new-container nginx

❌ Error: Port Already Allocated

Example:

port is already allocated

Find containers using ports:

docker ps

You can choose another host port:

docker run -d -p 8081:80 nginx

Now:

localhost:8081
    ↓
container:80

❌ Container Immediately Exits

Run:

docker ps -a

Then:

docker logs <container>

For example:

docker logs myapp

Check the exit code:

docker inspect myapp

A common reason is that the container's main process finished or crashed.

Remember:

A Docker container stays running only while its primary process is running.


❌ Cannot Enter Container With Bash

You may try:

docker exec -it mycontainer bash

and receive:

bash: executable file not found

Some lightweight images don't include Bash.

Try:

docker exec -it mycontainer sh

❌ Image Not Found

Example:

Unable to find image

Try:

docker pull image-name

Check the image name and tag:

docker search image-name

❌ Permission Denied on Linux

You may need:

sudo docker ps

If your Docker setup allows non-root access through the Docker group, configure it according to your system's Docker installation instructions.

Avoid blindly changing permissions on the Docker socket.


2️⃣2️⃣ Docker Commands Beginners Should Memorize

You don't need to memorize every Docker command.

Start with these:

docker --version
docker version
docker info

docker pull nginx
docker images

docker run nginx
docker run -d -p 8080:80 nginx

docker ps
docker ps -a

docker stop <container>
docker start <container>
docker restart <container>
docker rm <container>

docker logs <container>
docker exec -it <container> sh

docker inspect <container>
docker stats

docker build -t myapp:latest .
docker rmi <image>

docker login
docker tag <image> <username>/<image>:latest
docker push <username>/<image>:latest

docker volume ls
docker volume create <volume>

docker network ls
docker network create <network>

docker compose up -d
docker compose down
docker compose ps
docker compose logs -f
docker compose exec <service> sh

If you understand these commands, you already have a strong foundation.


2️⃣3️⃣ Docker Cheat Sheet

πŸ”΅ Docker Basics

Command Purpose
docker --version Check Docker version
docker version Show client/server version
docker info Show Docker system information
docker --help Show help

🟒 Containers

Command Purpose
docker run Create and start container
docker create Create container
docker start Start stopped container
docker stop Stop container
docker restart Restart container
docker pause Pause container
docker unpause Resume container
docker kill Force stop container
docker rm Remove container
docker rename Rename container
docker ps List running containers
docker ps -a List all containers
docker exec Execute command inside container
docker attach Attach to main process
docker logs View logs
docker stats Resource usage
docker top Running processes
docker inspect Detailed information
docker port Show port mappings
docker diff Show filesystem changes

🟑 Images

Command Purpose
docker pull Download image
docker build Build image
docker images List images
docker image ls List images
docker rmi Remove image
docker tag Create image tag
docker history Show image layers
docker save Save image to tar
docker load Load image from tar
docker inspect Inspect image/object

🟣 Volumes

Command Purpose
docker volume create Create volume
docker volume ls List volumes
docker volume inspect Inspect volume
docker volume rm Remove volume
docker volume prune Remove unused volumes

πŸ”΄ Networks

Command Purpose
docker network create Create network
docker network ls List networks
docker network inspect Inspect network
docker network connect Connect container
docker network disconnect Disconnect container
docker network rm Remove network
docker network prune Remove unused networks

🟠 Registry

Command Purpose
docker login Login to registry
docker logout Logout
docker search Search Docker Hub
docker tag Tag image
docker push Push image
docker pull Pull image

🟀 Compose

Command Purpose
docker compose up Create/start services
docker compose down Stop/remove stack
docker compose build Build services
docker compose ps List services
docker compose logs View logs
docker compose exec Execute command
docker compose pull Pull images
docker compose push Push images
docker compose start Start existing services
docker compose stop Stop services
docker compose restart Restart services
docker compose run Run one-off command
docker compose config Validate/render config

🧠 Most Important Docker Concepts to Understand

Don't just memorize commands.

Understand these relationships:

Dockerfile
     ↓
docker build
     ↓
Docker Image
     ↓
docker run
     ↓
Docker Container
     ↓
docker stop
     ↓
Stopped Container
     ↓
docker start
     ↓
Running Container

For persistent storage:

Container
    ↓
Volume
    ↓
Persistent Data

For networking:

Container A
     ↕
Docker Network
     ↕
Container B

For image distribution:

Dockerfile
    ↓
Build Image
    ↓
Tag Image
    ↓
Docker Registry
    ↓
Push Image
    ↓
Pull Image
    ↓
Run Container

πŸš€ Real-World Docker Workflow

A common application workflow looks like this:

Step 1: Create Dockerfile

FROM node:22-alpine

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 3000

CMD ["npm", "start"]

Step 2: Build Image

docker build -t my-node-app:1.0 .

Step 3: Run Container

docker run -d \
  --name my-node-app \
  -p 3000:3000 \
  my-node-app:1.0

Step 4: Check Container

docker ps

Step 5: Check Logs

docker logs my-node-app

Step 6: Enter Container

docker exec -it my-node-app sh

Step 7: Stop Application

docker stop my-node-app

Step 8: Remove Container

docker rm my-node-app

πŸ”„ Docker CI/CD Workflow

Docker is heavily used in CI/CD pipelines.

A simplified workflow looks like:

Developer
    ↓
Git Push
    ↓
CI Pipeline
    ↓
Run Tests
    ↓
docker build
    ↓
Docker Image
    ↓
docker tag
    ↓
docker push
    ↓
Container Registry
    ↓
Deployment Server
    ↓
docker pull
    ↓
docker run

For example:

docker build -t myapp:1.0 .

Then:

docker tag myapp:1.0 username/myapp:1.0

Then:

docker push username/myapp:1.0

On the deployment server:

docker pull username/myapp:1.0

Then:

docker run -d username/myapp:1.0

This is one of the fundamental Docker workflows used in DevOps.


🎯 Docker Interview Questions Based on These Commands

If you're preparing for a DevOps interview, make sure you can answer these.

1. What is the difference between docker run and docker start?

docker run
= Create + Start a new container

docker start
= Start an existing stopped container

2. What is the difference between docker stop and docker kill?

docker stop
= Graceful shutdown

docker kill
= Forceful shutdown

3. What is the difference between an image and a container?

Image
= Template/package

Container
= Running instance of an image

4. What is the difference between docker exec and docker attach?

docker exec
= Starts a new process

docker attach
= Connects to the existing main process

5. What is the difference between docker save and docker export?

docker save
= Save an image

docker export
= Export a container filesystem

6. What is the difference between docker compose up and docker compose start?

docker compose up
= Creates/recreates and starts services when needed

docker compose start
= Starts existing service containers

7. How do you check container logs?

docker logs <container>

8. How do you enter a running container?

docker exec -it <container> sh

or:

docker exec -it <container> bash

depending on the image.


9. How do you check Docker disk usage?

docker system df

10. How do you remove unused Docker resources?

docker system prune

⚠️ Important Docker Safety Tips

Docker commands can delete data, so be careful.

Especially review these commands before running them:

docker rm -f
docker rmi -f
docker volume rm
docker volume prune
docker system prune
docker system prune -a

The most dangerous mistake for beginners is deleting a volume containing important database data.

Before cleanup, inspect:

docker volume ls

and:

docker system df

🧩 Docker Command Mental Model

If you forget a command, think about what you are trying to manage.

What am I managing?
        |
        +---- Container?
        |       |
        |       +-- docker ps
        |       +-- docker run
        |       +-- docker stop
        |       +-- docker exec
        |       +-- docker logs
        |
        +---- Image?
        |       |
        |       +-- docker pull
        |       +-- docker build
        |       +-- docker images
        |       +-- docker push
        |
        +---- Volume?
        |       |
        |       +-- docker volume ls
        |       +-- docker volume create
        |       +-- docker volume inspect
        |
        +---- Network?
        |       |
        |       +-- docker network ls
        |       +-- docker network create
        |       +-- docker network inspect
        |
        +---- Multi-container app?
        |       |
        |       +-- docker compose up
        |       +-- docker compose down
        |       +-- docker compose logs
        |
        +---- Build?
                |
                +-- docker build
                +-- docker buildx build

This mental model is much more useful than trying to memorize hundreds of commands.


πŸ“š Docker Learning Roadmap

If you are completely new to Docker, don't try to learn everything in one day.

Follow this order:

1. Docker Basics
       ↓
2. Images
       ↓
3. Containers
       ↓
4. Dockerfile
       ↓
5. Ports
       ↓
6. Volumes
       ↓
7. Networks
       ↓
8. Docker Compose
       ↓
9. Docker Registry
       ↓
10. Docker Buildx
       ↓
11. CI/CD
       ↓
12. Kubernetes

πŸ† Docker Commands You Should Know for DevOps

If your goal is to become a DevOps Engineer, prioritize these:

docker pull
docker build
docker run
docker ps
docker ps -a
docker stop
docker start
docker restart
docker rm
docker exec
docker logs
docker inspect
docker stats
docker images
docker rmi
docker tag
docker push
docker login

docker volume ls
docker volume create
docker volume inspect

docker network ls
docker network create
docker network inspect
docker network connect

docker compose up
docker compose down
docker compose ps
docker compose logs
docker compose exec
docker compose build

docker system df
docker system prune

docker buildx build
docker buildx ls

πŸ’‘ Final Advice for Beginners

The biggest mistake beginners make is trying to memorize Docker commands.

Don't do that.

Instead, understand the lifecycle:

Build
  ↓
Image
  ↓
Run
  ↓
Container
  ↓
Inspect
  ↓
Logs
  ↓
Debug
  ↓
Stop
  ↓
Remove

Then understand supporting resources:

Container
   β”œβ”€β”€ Network
   β”œβ”€β”€ Volume
   └── Image

And for multi-container applications:

Docker Compose
      ↓
Multiple Containers
      ↓
Networks + Volumes
      ↓
Complete Application

Once you understand this flow, Docker commands become much easier.


πŸ“ Quick Docker Practice Lab

If you are a beginner, try these commands yourself.

Step 1 β€” Pull Nginx

docker pull nginx

Step 2 β€” Run Nginx

docker run -d --name my-nginx -p 8080:80 nginx

Step 3 β€” Check Container

docker ps

Step 4 β€” Open in Browser

http://localhost:8080

Step 5 β€” Check Logs

docker logs my-nginx

Step 6 β€” Inspect

docker inspect my-nginx

Step 7 β€” Enter Container

docker exec -it my-nginx sh

Step 8 β€” Check Processes

docker top my-nginx

Step 9 β€” Check Resources

docker stats my-nginx

Step 10 β€” Stop Container

docker stop my-nginx

Step 11 β€” Start Again

docker start my-nginx

Step 12 β€” Remove Container

docker stop my-nginx
docker rm my-nginx

Congratulations πŸŽ‰

You have just completed a basic Docker container lifecycle.


πŸ”₯ Final Docker Cheat Sheet

# Docker
docker --version
docker version
docker info
docker --help

# Images
docker pull nginx
docker images
docker build -t myapp .
docker rmi myapp
docker tag myapp username/myapp:v1
docker push username/myapp:v1
docker history nginx
docker save -o image.tar myapp
docker load -i image.tar

# Containers
docker run -d nginx
docker run --name web -d -p 8080:80 nginx
docker ps
docker ps -a
docker create nginx
docker start web
docker stop web
docker restart web
docker pause web
docker unpause web
docker kill web
docker rm web
docker rename web web-server

# Debugging
docker logs web
docker logs -f web
docker inspect web
docker exec -it web sh
docker top web
docker stats web
docker port web
docker diff web
docker events

# Files
docker cp file.txt web:/tmp/
docker cp web:/tmp/file.txt .

# Volumes
docker volume create data
docker volume ls
docker volume inspect data
docker volume rm data
docker volume prune

# Networks
docker network create app-network
docker network ls
docker network inspect app-network
docker network connect app-network web
docker network disconnect app-network web
docker network rm app-network
docker network prune

# Cleanup
docker system df
docker container prune
docker image prune
docker network prune
docker volume prune
docker system prune
docker system prune -a

# Registry
docker login
docker logout
docker search nginx
docker tag myapp username/myapp:latest
docker push username/myapp:latest

# Compose
docker compose up -d
docker compose down
docker compose build
docker compose up --build -d
docker compose ps
docker compose logs -f
docker compose exec web sh
docker compose pull
docker compose push
docker compose start
docker compose stop
docker compose restart
docker compose run web sh
docker compose config
docker compose ls

# Context
docker context ls
docker context show
docker context inspect
docker context create
docker context use
docker context rm

# Buildx
docker buildx ls
docker buildx create --name builder
docker buildx use builder
docker buildx inspect builder
docker buildx build -t myapp .

# Swarm
docker swarm init
docker node ls
docker service create
docker service ls
docker service ps
docker service scale
docker service update
docker service rm
docker stack deploy
docker stack ls
docker stack services
docker stack ps
docker stack rm

🎯 Conclusion

Docker becomes much easier when you stop treating it as a collection of commands and start understanding the relationship between its components.

Remember this:

Dockerfile
     ↓
docker build
     ↓
Image
     ↓
docker run
     ↓
Container
     ↓
docker exec / logs / inspect
     ↓
Debug & Manage
     ↓
docker stop
     ↓
docker rm

For persistent data:

Volume

For communication:

Network

For multiple containers:

Docker Compose

For sharing images:

Docker Registry

For multi-platform builds:

Docker Buildx

For container orchestration with Docker:

Docker Swarm

The official Docker CLI reference provides the current command hierarchy and includes areas such as containers, images, Compose, contexts, Buildx, manifests, and newer CLI capabilities.

The best way to learn Docker is simple:

Don't just read Docker commands. Run them. Break things. Inspect them. Fix them. Repeat.

Start with:

docker run
docker ps
docker logs
docker exec
docker inspect
docker stop
docker rm

Then move to:

docker build
docker volume
docker network
docker compose
docker push
docker buildx

With regular practice, Docker will stop feeling like a huge list of commands and start feeling like a logical workflow.


πŸš€ What's Next?

If you're learning DevOps, your next topics after Docker should be:

Docker
   ↓
Docker Compose
   ↓
Docker Registry
   ↓
Jenkins / GitHub Actions
   ↓
CI/CD
   ↓
AWS
   ↓
Kubernetes
   ↓
Helm
   ↓
Monitoring
   ↓
Prometheus + Grafana

Keep practicing, keep building, and keep shipping. πŸš€πŸ³

Happy Dockering!

πŸš€ Complete Learning & Career Resources | 2027–2028

A curated collection of learning resources for AI, Data Analytics, Python, Data Engineering, Cybersecurity, Cloud, Networking, Finance, Digital Marketing, Project Management, DevOps and Generative AI.

πŸ“š Learn Β β†’Β  πŸ§ͺ Practice Β β†’Β  πŸ› οΈ Build Β β†’Β  πŸ™ Share Β β†’Β  πŸš€ Grow


🌟 About This Repository

Welcome to the Complete Learning & Career Resources Repository! πŸš€

This repository is designed as a centralized learning hub for students, developers, QA engineers, DevOps engineers, cloud learners, cybersecurity enthusiasts, data professionals, project managers, business professionals and anyone interested in continuous learning.

The goal is simple:

Learn β†’ Practice β†’ Build β†’ Document β†’ Share β†’ Grow

Instead of searching for useful resources again and again, this repository brings them together in one place.


🎯 What You Will Find Here

  • πŸ€– Artificial Intelligence

  • 🧠 Generative AI

  • πŸ“Š Data Analytics

  • 🐍 Python

  • βš™οΈ Data Engineering

  • ☁️ Cloud Computing

  • 🌐 Computer Networking

  • πŸ” Cybersecurity

  • βš™οΈ DevOps

  • πŸ“‹ Project Management

  • πŸ’° Finance

  • πŸ“ˆ Digital Marketing

  • 🧩 Business Analysis

  • πŸš€ Career Development

  • πŸŽ“ Professional Learning

  • πŸ› οΈ Project Ideas

  • πŸ“š Learning Roadmaps


πŸ“Š Repository Overview

Category Resources
πŸ€– AI Courses 15
πŸ”΅ Google Courses 15
🟣 IBM Courses 10
πŸ”₯ Best Courses 2027–2028 21
🌟 Learning & Career Resources 14
πŸ“– Personal Resources 4+

πŸ“š Table of Contents


πŸ€– AI Courses

πŸš€ Explore AI fundamentals, Python, AI infrastructure, Generative AI, AI governance and specialized AI applications.

# Course Link
1 AI For Everyone Start Course β†—
2 AI Python for Beginners Start Course β†—
3 AI Infrastructure and Operations Fundamentals Start Course β†—
4 Generative AI for Human Resources (HR) Professionals Start Course β†—
5 AI Fundamentals Start Course β†—
6 AI for Healthcare Start Course β†—
7 AI Applications in Accounting and Finance Start Course β†—
8 AI Governance and Privacy Professional Certification (AIGP) Start Course β†—
9 Ethics and Governance in the Age of Generative AI Start Course β†—
10 Hands-on quantum error correction with Google Quantum AI Start Course β†—
11 AI-Powered Higher Education Start Course β†—
12 Modern Project Leadership: Agile, AI, and Beyond Start Course β†—
13 AI-Powered Business Analysis: Excel, KPIs & GenAI Start Course β†—
14 AI in Law: Research, Risk, and Legal Drafting Start Course β†—
15 Generative AI for Project Managers Start Course β†—

πŸ”΅ Google Courses

🌐 Explore Data Analytics, AI, Cybersecurity, Networking, Cloud, Digital Marketing and Project Management.

# Course Link
1 Foundations: Data, Data, Everywhere Start Course β†—
2 Ask Questions to Make Data-Driven Decisions Start Course β†—
3 Prepare Data for Exploration Start Course β†—
4 Agile Project Management Start Course β†—
5 Project Initiation: Starting a Successful Project Start Course β†—
6 AI Fundamentals Start Course β†—
7 Foundations of Digital Marketing and E-commerce Start Course β†—
8 Play It Safe: Manage Security Risks Start Course β†—
9 The Bits and Bytes of Computer Networking Start Course β†—
10 Analyze Data to Answer Questions Start Course β†—
11 Automate Cybersecurity Tasks with Python Start Course β†—
12 Architecting with Google Compute Engine Start Course β†—
13 AI for Writing and Communicating Start Course β†—
14 From Likes to Leads: Interact with Customers Online Start Course β†—
15 AI for Data Analysis Start Course β†—

🟣 IBM Courses

πŸ’™ Explore SQL, Python, Data Analytics, Deep Learning, RAG and Generative AI resources.

# Course Link
1 Databases and SQL for Data Science with Python Start Course β†—
2 RAG and Agentic AI Capstone Project Start Course β†—
3 Excel Basics for Data Analysis Start Course β†—
4 Introduction to Data Analytics Start Course β†—
5 Data Visualization and Dashboards with Excel and Cognos Start Course β†—
6 IBM AI Foundations for Business Start Course β†—
7 AI Capstone Project with Deep Learning Start Course β†—
8 Python Project for Data Engineering Start Course β†—
9 Building Generative AI-Powered Applications with Python Start Course β†—
10 Vector Databases for RAG: An Introduction Start Course β†—

πŸ”₯ Best Courses 2027–2028

🎯 A broader collection covering AI, Data, Python, Finance, Cybersecurity, Marketing, Networking, Management and Data Engineering.

# Course Link
1 AI For Everyone Start Course β†—
2 Foundations: Data, Data, Everywhere Start Course β†—
3 Ask Questions to Make Data-Driven Decisions Start Course β†—
4 Prepare Data for Exploration Start Course β†—
5 Financial Markets Start Course β†—
6 Agile Project Management Start Course β†—
7 Play It Safe: Manage Security Risks Start Course β†—
8 Project Initiation: Starting a Successful Project Start Course β†—
9 AI Fundamentals Start Course β†—
10 Analyze Data to Answer Questions Start Course β†—
11 Foundations of Digital Marketing and E-commerce Start Course β†—
12 The Bits and Bytes of Computer Networking Start Course β†—
13 Sequence Models Start Course β†—
14 Federal Taxation I: Individuals, Employees, and Sole Proprietors Start Course β†—
15 Designing the Organization Start Course β†—
16 Game Theory Start Course β†—
17 Using Python to Access Web Data Start Course β†—
18 Viral Marketing and How to Craft Contagious Content Start Course β†—
19 Python Project for Data Engineering Start Course β†—
20 Value Chain Management Start Course β†—
21 Applying Data Analytics in Finance Start Course β†—

🌟 Learning & Career Resources

πŸ’‘ Additional resources for learning, career development, language learning, hosting, education and professional growth.

Category Program Tracking Link
πŸ“± Apps AppSumo https://appsumo.8odi.net/c/5203965/416948/7443
🌐 Website Hosting Automattic, Inc. (WordPress.com, Pressable, WooCommerce, Jetpack) https://automattic.pxf.io/c/5203965/1900456/22744
πŸ‡¬πŸ‡§ College British Council - EOL English Online https://englishonline.sjv.io/c/5203965/1152772/14579
πŸ“š Educational Carson Dellosa Education https://carsondellosaeducation.sjv.io/c/5203965/2241626/29119
πŸŽ“ College Coursera B2C Affiliate Program https://imp.i384100.net/c/5203965/1164545/14726
πŸ“Š Learning DataCamp https://datacamp.pxf.io/c/5203965/1012793/13294
🎨 Collectibles & Hobbies Domestika https://domestika.sjv.io/c/5203965/1492994/17608
πŸŽ“ College edX https://edx.sjv.io/c/5203965/1505390/17728
πŸ’Ό Career Medical Spanish https://curiositymediainc.sjv.io/c/5203965/2899794/33984
πŸ§ͺ Educational MEL Science https://imp.i328067.net/c/5203965/574569/9515
πŸ—£οΈ Apps Preply Learners https://preply.sjv.io/c/5203965/1987575/24422
🌍 Learning Rosetta Stone https://aff.rosettastone.com/c/5203965/1637427/18979
πŸ›οΈ Website Hosting Shopify https://shopify.pxf.io/c/5203965/1061744/13624
🎯 Learning Udemy https://trk.udemy.com/c/5203965/3193860/39854

πŸ—ΊοΈ Recommended Learning Roadmaps

Choose one roadmap according to your career goal. You don't need to learn everything at once.


πŸ€– AI Roadmap

AI Fundamentals
      ↓
Python Basics
      ↓
Mathematics & Statistics
      ↓
Data Fundamentals
      ↓
Machine Learning
      ↓
Deep Learning
      ↓
Generative AI
      ↓
Prompt Engineering
      ↓
RAG
      ↓
Vector Databases
      ↓
Agentic AI
      ↓
AI Applications
      ↓
Real-World Projects
      ↓
GitHub Portfolio