Running a Test Container
Now that we've confirmed Docker is installed and running (Part 1), let's test the setup by running a simple container. This will verify that Docker can successfully download images and run containers.
The Hello World Container
Docker offers a lightweight "hello-world" image specifically designed to test Docker installations. This minimal container confirms that:
• The Docker client can connect to the Docker daemon.
• The Docker daemon has access to pull images from Docker Hub.
• Docker can create and launch or run containers.
1.Let's run this test container with the following command:
docker run hello-world
When you run this command for the first time, Docker will:
• Check if the hello-world image exists locally
• If not, download it from Docker Hub
• Create a container from this image
• Start the container, which prints a message and exits
This message confirms that your Docker installation is working correctly.
Listing Containers
After running the hello-world container, let's check the list of containers on your system. The container we just ran has already exited, but we can still see it in the list of all containers.
2.To see all containers (including stopped ones), run:
docker ps -a
The -a
flag shows all containers, including those that have stopped. Without this flag, docker ps
would only show running containers.
Note the STATUS
column shows "Exited (0)"
, which means the container completed its task and exited with a status code of 0 (indicating success).
Listing Docker Images
- The hello-world image was downloaded to your local machine. Let's verify this by listing all Docker images:
docker images
This confirms that the hello-world image is stored locally on your system.
LinkedIn: https://linkedin.com/in/kamrul-dev
GitHub: https://github.com/kamrul-dev
Related Keywords:
How to verify Docker installation on your system,
Checking Docker version and system info via CLI,
Confirming Docker is properly installed on Linux/Mac/Windows,
Commands to check Docker installation status,
Troubleshooting Docker setup issues,
Kamrul Hasan DevOps Engineer,
DevOps tips by Kamrul Hasan,
Kamrul Hasan Docker tutorials,
Learn DevOps with Kamrul Hasan,
Kamrul Hasan automation expert,
Kamrul Hasan cloud and containers,
CI/CD pipelines by Kamrul Hasan,
Kamrul Hasan Kubernetes & Docker,
Top comments (0)