Guide
Docker
Beginner
Run a Web Container
Practice container lifecycle, port publishing, and logs.
Objective
Run nginx, verify its response, and observe the difference between stopping and removing a container.
Prerequisites
Complete installation and container lifecycle fundamentals. Use an available host port 8090.
Steps
docker run -d --name docker-lab-web -p 127.0.0.1:8090:80 nginx:alpine
docker ps --filter name=docker-lab-web
docker logs docker-lab-web
Open http://localhost:8090. Expect the nginx welcome page.
docker stop docker-lab-web
docker ps -a --filter name=docker-lab-web
docker start docker-lab-web
The stopped container remains listed. Starting it makes the page available again.
Verify Your Understanding
Why does the host use port 8090 while nginx listens on port 80? Why does the container ID stay the same after restarting?
Cleanup
docker stop docker-lab-web
docker rm docker-lab-web
Next Step
Add More Questions to This Guide
Know a question that should be here? Share it and help the community!
Open Google Form