DOCKER - 6 Commands and Setup
In this section we focus on containers, the fundamental building blocks of Docker. Before we start launching nginx and learning the basic operations (start, stop, remove, create), we need to confirm that Docker is properly installed. Two simple commands give us everything we need to check the setup.
docker version
docker info
docker version returns the version of both the client (the CLI you type into) and the server (the Docker engine running in the background — a service on Windows, a daemon on Mac/Linux). Both versions don't have to match exactly, but getting a server response proves the CLI can talk to the engine. If you see an error, you may need sudo docker version.
docker info shows much more: number of running containers, number of images stored, engine configuration, storage driver, plugins and so on. A lot of values may not make sense yet — that's fine, we'll dig into them later. To list all available commands, just type docker and press Enter.
Old vs new CLI style
- Legacy commands:
docker run nginx,docker ps,docker rm. Still works for commands older than four years. - Management commands (since 2017):
docker container run nginx,docker container ls,docker container rm. Same actions, but organized under management groups (container, image, network, volume…).
Both styles still work. Throughout this course we will use a bit of both so you get used to them. See you in the next video.
Summary
This lesson introduces the fundamental Docker commands and setup required to verify your installation and understand the Docker CLI structure. You'll learn how to use `docker version` to confirm client-server communication, `docker info` to view comprehensive engine configuration details, and explore the Docker command syntax. The lesson explains how Docker's management command structure was introduced to organize an ever-growing list of commands, and sets the foundation for working with containers in subsequent lessons.
Key points
- The `docker version` command verifies that the Docker client can communicate with the Docker server (engine) and is the first check on any new Docker system
- The `docker info` command provides detailed configuration information about your Docker engine, including running containers, stored images, and other system details
- Docker uses both old-style single commands and newer management command formats (e.g., `docker [management command] [subcommand]`) for backward compatibility
- Containers are the fundamental building blocks of Docker and must be understood before attempting to build images or work with advanced features
- The Docker CLI structure includes management commands that were created to organize and simplify the command interface when the number of available commands became too large
- Proper Docker setup verification ensures the client-server communication is working before proceeding to work with containers and networking
FAQ
What is the difference between `docker version` and `docker info`?
`docker version` returns only the version numbers of the Docker client and server engine to verify communication is working. `docker info` provides much more comprehensive configuration details about your Docker engine setup, including counts of running containers and stored images.
Why does Docker support both old and new command formats?
Docker introduced management commands to organize its growing list of commands into a more structured, user-friendly format. Both the older single-command format (e.g., `docker version`) and the newer management command format (e.g., `docker container ls`) continue to work for backward compatibility.
What should I check if Docker commands return an error?
If Docker commands return an error, it typically means the Docker client cannot communicate with the Docker server. You should verify that Docker is properly installed on your system and that the Docker engine is running as a service (Windows), daemon (macOS/Linux), or background process.