DevOps Learning Hub · DevOps Learning Hub
D_devops.hubStart learning ↗
CONTAINERS / MODULE 03

Docker fundamentals

Build, run and inspect containers with practical commands.

FIRST RUN01

Run a container

Download and run a tiny test image, then clean it up automatically.

docker run --rm hello-world
LIFECYCLE02

Start a web server

Run nginx in the background and publish its port locally.

docker run -d --name web -p 8080:80 nginx
INSPECT03

See what is running

List containers and read the last lines of the container log.

docker ps\ndocker logs --tail 20 web
BUILD04

Build your own image

Build the Dockerfile in the current directory and give it a tag.

docker build -t hello-app:dev .
NETWORK05

Connect with Compose

Start the services described in your compose file.

docker compose up -d
CLEANUP06

Stop a container

Stop and remove a named container when you finish experimenting.

docker stop web && docker rm web