0
0
Dockerdevops~3 mins

Verifying installation with docker run hello-world - Commands & Configuration

Choose your learning style9 modes available
Introduction
After installing Docker, you need to check if it works correctly. Running a simple test container helps confirm that Docker is set up and running on your computer.
Right after installing Docker to confirm the installation was successful
When you want to check if Docker service is running properly
Before starting to build or run your own containers to ensure the environment is ready
When troubleshooting Docker issues to verify basic container execution
To demonstrate Docker functionality to someone new learning about containers
Commands
This command downloads a small test image called 'hello-world' and runs it as a container. It prints a message to confirm Docker is working.
Terminal
docker run hello-world
Expected OutputExpected
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world Digest: sha256:7e4a6f1a1a3f3a3f3a3f3a3f3a3f3a3f3a3f3a3f3a3f3a3f3a3f3a3f3a3f3a3f3 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
Key Concept

If you remember nothing else from this pattern, remember: running 'docker run hello-world' confirms Docker is installed and working by running a simple test container.

Common Mistakes
Running 'docker run hello-world' without Docker service running
The command fails because Docker daemon is not active to run containers.
Start the Docker service before running the command, for example 'sudo systemctl start docker' on Linux.
Expecting the command to run instantly without internet connection
Docker needs to download the 'hello-world' image the first time, so it requires internet access.
Ensure your computer is connected to the internet when running the command for the first time.
Summary
Run 'docker run hello-world' to test if Docker is installed and working.
The command downloads and runs a small test container that prints a confirmation message.
If the message appears, Docker is ready for use on your system.