Learn how to pull an image, run a container, verify port mapping, inspect logs, and stop the container.
Understand the basic Docker workflow for starting and validating a containerized web service.
Download the official NGINX image from Docker Hub so it is available locally.
Command
docker pull nginxExpected Result
Docker downloads the image layers and reports that the image is ready.
Run NGINX in detached mode and publish port 8080 on your machine to port 80 in the container.
Command
docker run -d --name devops-nginx -p 8080:80 nginxExpected Result
Docker returns a container ID and the container starts in the background.
Check the list of running containers and confirm that NGINX is up.
Command
docker psExpected Result
You should see the devops-nginx container with a port mapping like 0.0.0.0:8080->80/tcp.
Visit the mapped port in your browser and confirm the default NGINX page loads.
Expected Result
You should see the default 'Welcome to nginx!' page.
Read container logs to confirm requests are reaching the service.
Command
docker logs devops-nginxExpected Result
You should see NGINX startup logs and HTTP access lines after visiting the page.
Clean up the lab environment after verifying the service.
Command
docker stop devops-nginx && docker rm devops-nginxExpected Result
The container stops and is removed successfully.
You can pull, run, verify, inspect, and clean up a Docker container.
You understand basic port publishing and log inspection.