Running containers
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
start, inspect, and stop containers.
Planned topics
docker run -d --name db -p 5432:5432 postgres:16starts a container in the background.-p host:containermaps a port so you can reach the app.-e NAME=valuesets environment variables.docker pslists running containers;docker stop,docker rmstop and remove.- Containers are disposable: removing one deletes its internal data unless you use a volume.
Draft outline details
Demonstration
docker run -d --name db -e POSTGRES_PASSWORD=dev -p 5432:5432 postgres:16
docker ps
docker stop db && docker rm dbCheck your understanding
What does -p 8080:80 do?
Show answer
Maps host port 8080 to container port 80.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.