Frequently Used Ubuntu Linux Keyboard Shortcuts on Raspberry Pi 400
Docker is primarily operated through the command-line interface (CLI).
Using CLI commands, users can manage images, check system status, run containers, and control the container lifecycle.
By understanding the structure and purpose of commonly used Docker commands, it becomes much easier to grasp Docker’s overall workflow and operating principles.
Most Docker commands follow a consistent pattern:
docker [object] [command] [options]
This structure helps users predict how commands work across different contexts.
Whether managing images, containers, or system resources, Docker maintains this unified command format.
Before using Docker, it is common to verify that Docker is installed and running correctly.
Displays the installed Docker client version
Useful for confirming successful installation
Shows overall Docker engine information
Includes container count, image count, storage driver, and system configuration
These commands provide general insight into the Docker environment without modifying anything.
Docker images are the foundation of containers.
They contain the filesystem, libraries, and application environment needed to run a container.
Lists all images stored locally
Displays image name, tag, ID, and size
Downloads an image from a remote registry such as Docker Hub
Prepares images for later container execution
Removes images from the local system
Commonly used when cleaning up unused resources
Understanding image commands helps clarify how Docker environments are built and reused.
Containers are running instances of Docker images.
Most Docker workflows revolve around creating and managing containers.
Creates and starts a container from an image
If the image does not exist locally, Docker pulls it automatically
Internally, this command performs several steps:
Checks for the image
Creates a container
Starts execution
This makes docker run one of the most frequently used Docker commands.
Since multiple containers can run simultaneously, visibility is important.
Displays currently running containers
Shows container ID, name, status, and runtime information
Displays all containers, including stopped ones
Useful for reviewing container history
These commands provide an overview of container activity within the system.
Docker allows containers to be started, stopped, and restarted as needed.
Gracefully stops a running container
Starts a previously stopped container
Stops and restarts a container in one step
These commands manage the container lifecycle without affecting the underlying image.
Containers that are no longer needed can be removed.
Deletes stopped containers
Helps keep the system organized
Since containers can be recreated from images at any time, removing unused containers is a normal part of Docker usage.
Docker allows users to interact directly with a running container.
Executes a command inside an active container
Often used to inspect the runtime environment
This command helps users understand how applications behave inside containers.
Container output is captured through logs.
Displays standard output and error logs
Useful for observing application behavior
Logs provide insight into what a container is doing without direct interaction.
As Docker usage increases, unused resources can accumulate.
Shows disk usage by Docker resources
Removes unused containers, images, and networks
Helps maintain a clean Docker environment
These commands focus on visibility and organization rather than configuration changes.
Rather than memorizing commands, it is more effective to understand Docker’s core flow:
Images define environments
Containers execute images
Commands control creation, execution, and cleanup
Once this structure is clear, new Docker commands become easier to understand.
Docker’s basic commands may feel complex at first, but as you begin using them, you will naturally understand how images and containers interact.
These core commands form the foundation of container-based workflows.
These fundamental concepts also serve as the basis for understanding topics such as Dockerfiles, Docker Compose, and container networking.