DOCKER - 6 Commands and Setup
Welcome to this introduction to Docker. In this section we focus on containers, the fundamental building blocks of the Docker toolkit. Before building images or tackling advanced topics, we need to understand what containers are, how to run them, how they differ from virtual machines, and the basic features they provide. The very first step is making sure Docker is properly installed and that we are running the latest version. Throughout the upcoming lessons we will use Nginx, a simple web server, to learn Docker commands and explore how containers behave.
Checking the Docker engine
The first command to run on any new Docker system is docker version. It returns the version of both your client and the server (also called the engine). The engine runs in the background on your machine: on Windows it is a service, while on Mac and Linux it is a daemon. The command line communicates with the server and prints the version of each side. Ideally both versions match, but they don't have to be identical. Receiving the server's response confirms that the client can talk to the engine. If you get an error, you may need to prefix the command with sudo.
To dig deeper, run docker info. It returns far more than the version: a lot of details about the engine's configuration, including the number of running containers and stored images. Some values are obvious, others will only make sense as the course progresses. Don't worry if everything isn't clear yet.
To list every available command, simply type docker and press Enter. You will notice a section called Management Commands. In early 2017, Docker had so many commands that they introduced this format to better organise them. The new pattern is docker <management-command> <subcommand>, while older commands keep working with the historical syntax docker <command> <options>.
docker version— verify the client can talk to the enginedocker info— inspect the engine's configuration valuesdocker <cmd>vsdocker <mgmt> <sub>— both syntaxes coexist
That's all for this video, see you in the next one.
Summary
This lesson introduces Docker containers as the fundamental building blocks of Docker and covers essential setup commands to verify a Docker installation works correctly. You will learn how to check Docker versions with `docker version` and explore system configuration with `docker info`, then understand how Docker command syntax works—both the legacy format and newer management command structure. The lesson sets the foundation for future lessons on container management, networking, and hands-on examples using nginx.
Key points
- Containers are the fundamental building blocks of Docker and the first concept to master before learning advanced features
- Use `docker version` to verify the Docker client can communicate with the server/engine, which indicates proper installation
- Use `docker info` to retrieve detailed configuration information about your Docker engine
- Docker supports two command syntax formats: legacy format (e.g., `docker <command> <options>`) and newer management commands (e.g., `docker <management-command> <sub-command>`)
- The Docker server (engine) runs as a service on Windows or as a daemon on Mac/Linux, communicating with the CLI client
- Identical client and server versions are ideal but not strictly required for Docker to function correctly
FAQ
What is the difference between a Docker container and a virtual machine?
The transcript introduces that this distinction will be explained later in the course. Containers are presented as fundamental Docker building blocks, but detailed comparison with VMs is deferred to subsequent lessons.
Why is `docker version` the first command to run on a new Docker system?
The `docker version` command confirms that your CLI client can communicate with the Docker server/engine, ensuring Docker is properly installed and functioning before proceeding with other operations.
What is the difference between Docker's old command format and the new management command format?
The old format uses `docker <command> <options>`, while the new management format uses `docker <management-command> <sub-command>`. Both formats continue to work, and you can choose whichever you prefer throughout the course.