Now that we have Docker installed we need to verify that it is installed correct and operational. We will look at using the Docker Command Line Interface (CLI). Using the Docker CLI we will be able to download containers, launch containers, check the status of containers and more! This part of the module is just making sure Docker is operational. We will cover more about the Docker CLI as we move forward within this module.
To test our Docker install we will use a container called Hello World. This command that we will use will download and run the container. When the container is launched it will display text that says that your docker install is good to go.
You will want to use a command prompt to issue this command. In Windows you can use cmd or PowerShell. In MacOS you can use the Terminal app. Once you have a terminal window open issue the following command:
docker run hello-world
If this command is successful it should download the hello-world container and display the following (make sure to read it as it does provide helpful information):
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.
(amd64)
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/
The above provides you with how to go about testing, but I also want to provide you with a few demos that show how to start a cmd shell, PowerShell or Terminal window. I have provide two videos below one is for our Window users and the other is for our MacOS users. I only have access to Windows 10, but the process should be the same for our Windows 11 users.
Demo showing that Docker is able to pull and run the hello-world container image on MacOS. While watching the video make it full screen to be able to see easier.
Demo showing that Docker is able to pull and run the hello-world container image on Windows. While watching the video make it full screen to be able to see easier.