Skip to content
Ameen Abozaid
Planned lessonJNR-049-L03

Running containers

  • Lesson 3 of 8
  • Junior
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:16 starts a container in the background.
  • -p host:container maps a port so you can reach the app.
  • -e NAME=value sets environment variables.
  • docker ps lists running containers; docker stop, docker rm stop and remove.
  • Containers are disposable: removing one deletes its internal data unless you use a volume.
Draft outline details

Demonstration

bash
docker run -d --name db -e POSTGRES_PASSWORD=dev -p 5432:5432 postgres:16
docker ps
docker stop db && docker rm db

Check 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.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.