Install Docker and Understand the First Run
Overview
Before running containers, verify that Docker is installed and that the Docker CLI can communicate with the Docker daemon. Docker Desktop includes a graphical application and Docker Engine on Windows and macOS. Linux distributions can install Docker Engine and supporting packages directly.
Detailed Notes
Verify the installation
docker --version
docker version
docker --version prints the CLI version. docker version prints both the Client and Server sections. If the server section says it cannot connect, Docker Engine or Docker Desktop is not running, or the CLI cannot reach the daemon.
docker run hello-world
Read this command from left to right:
dockercalls the Docker CLI.runasks Docker to create and start a container.hello-worldnames the image.
If the image is not cached, Docker pulls it from Docker Hub. The daemon creates a container with a writable layer. It starts the image's default command. The process prints a success message and exits. Docker keeps the stopped container until you remove it.
Common checks
docker info
docker ps
docker ps -a
docker images
docker infosummarizes daemon configuration.docker psshows running containers.docker ps -ashows running and stopped containers.docker imagesshows local image layers and tags.
Practice task
- Run
docker run hello-world. - Run
docker ps; the container is expected to be absent because it exited. - Run
docker ps -a; locate the stopped hello-world container. - Remove it with
docker rm CONTAINER_NAME. - Run
docker imagesand locatehello-world.
Common Interview Questions
Finished this lesson?
0 of 27 lessons done · 0% of the course

