Lesson 5 / 26

Running a Container

docker run creates and starts a container from an image.

docker run basics

-d runs it in the background (detached), -it gives you an interactive terminal.

docker run -d nginx
docker run -it ubuntu bash   # interactive shell inside the container

pull happens automatically

If the image isn't local yet, docker run pulls it first automatically — you don't need a separate docker pull step.