Docker Commands
These docker commands don’t fit neatly into any category but are essential on their own. They help you get more out of docker.
docker → The base command for the Docker CLI
docker version → Show the Docker version information
docker init → Creates Docker-related starter files for your project
docker search → Search Docker Hub for images
docker login → Authenticate to a registry
docker logout → Log out from a registry
docker inspect → Return low-level information on Docker objects
docker debug → Get a shell into any container or image.
Docker
docker → The base command for the Docker CLIUsage: docker [OPTIONS] COMMANDDescription:
Docker commands may need sudo. To skip that extra step, an admin can create a docker group and add users to it. Then you can run Docker directly - no sudo required. 🚀
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
Docker Version
docker version → Show the docker version informationUsage : docker version [OPTIONS]Description:
- Prints the version numbers of all Docker components.
docker version→ shows versions of Docker components.docker -v, --version→ shows the version of the Docker CLI itself.- Use
--formatto customize the output.
Docker Help
docker COMMAND --help → More information for the commandDescription:
This command shows a list of available Docker commands and options. It’s like Docker’s built‑in guidebook for helping you quickly understand what each command does and how to use it.
Docker Commands
These docker commands don’t fit neatly into any category but are essential on their own. They help you get more out of docker.
Docker init
docker init → Creates Docker-related starter files for your projectUsage : docker init [OPTIONS]
Aliases : NADescription:
- Requires:Docker Desktop 4.27 and later.
- Initializes a project with all the files needed to run in a container.
- Creates sensible defaults for:
.dockerignore
Dockerfilecompose.yaml(or overwrites docker-compose.yaml)README.Docker.md- If files already exist, Docker warns you and asks if you want to overwrite. ⚠️ Overwritten files cannot be recovered, so back them up first.
- Provides templates for different project types:
- ASP.NET Core, Go, Java (Maven/uber jar), Node, PHP+Apache, Python, Rust, or a general-purpose “Other”.
- After setup, you can customize the files for your project’s needs.

Docker search
docker search → Search Docker Hub for imagesUsage : docker search [OPTIONS] TERM
Aliases : NADescription:
- Searches Docker Hub for images.
- Helps you find official or community images to use in your projects.
- You can filter results with flags (e.g., stars, official, automated).

Docker login
docker login → Authenticate to a registry (public or private)Usage : docker login [OPTIONS] [SERVER]
Aliases : NADescription:
- Credentials are stored in a credential store (more secure) or in config.json (less secure).
- On Docker Desktop → credentials go into your OS keychain automatically.
- Without Docker Desktop → you configure the credential store in
$HOME/.docker/config.json(Linux) or%USERPROFILE%/.docker/config.json(Windows). - Authentication Method = Username + password or access token.
- Docker Hub supports web-based sign-in and device code flow (secure default).

Docker logout
docker logout → Logout from a registryUsage : docker logout [SERVER]
Aliases : NADescription:
- Logs you out from a registry. If no server is specified, Docker uses the default registry defined by the daemon.

Docker inspect
docker inspect → Return low-level information on Docker objectsUsage : docker inspect [OPTIONS] NAME|ID [NAME|ID...]
Aliases : NADescription:
- Provides detailed information on Docker objects (containers, images, volumes, networks, etc.).
- By default, results are shown in a
JSONarray. - Useful for debugging, auditing, or checking configuration details.

Docker debug
docker debug → Get a shell into any container or image. An alternative to debugging with `docker exec`.Usage : debug [OPTIONS] {CONTAINER|IMAGE}
Aliases : NADescription:
- Requires:Docker Desktop 4.49 and later
- Helps you debug slim images/containers that normally lack tools.
- Opens a debug shell into any container or image, even if no shell exists.
- Does not modify the actual image or container.
- Comes with a toolbox (vim, nano, htop, curl, etc.) and supports bash, fish, zsh.
- You can add/remove tools using built‑in commands:
install [tool]→ add Nix packagesuninstall [tool]→ remove packagesentrypoint→ print, lint, or run entrypointbuiltins→ list available built‑in tools
- Changes in stopped images/containers are discarded when you exit.
- For running/paused containers, changes are visible to the container but
/nixstays hidden.
Docker Daemon
The Docker Daemon (dockerd) is the background service that manages Docker containers, images, networks, and volumes. It listens for Docker API requests and communicates with the Docker CLI (docker) to execute container operations. Without the daemon running, Docker commands won’t work.
Service Management
# Show the current status of the Docker service.
sudo systemctl status docker
# Start the Docker service.
sudo systemctl start docker
# Stop the Docker service
sudo systemctl start docker# Restart the Docker service.
sudo systemctl restart docker
# Enable Docker to auto‑start on system boot.
sudo systemctl enable docker
# Disable Docker from auto‑starting on boot.
sudo systemctl disable docker
Configuration
Edit daemon settings: Config file is usually at /etc/docker/daemon.json in linux.
{
"storage-driver": "overlay2",
"log-level": "info",
"insecure-registries": ["myregistry.local:5000"]
}
# After changes
sudo systemctl restart dockerLogs & Debugging
# Run daemon in debug mode
sudo dockerd --debug
# View daemon logs
journalctl -u docker
Follow for Engineering and Tech - Tips, Tricks, Roadmaps, Resources, Networking, Motivation, Guidance, and Cool Stuff ♥

