- All Courses
- Docker Essentials
- Containers from First Principles
- Running your first container
Running your first container
Running a container starts it from an image with the arguments you supply: which ports to publish, which directories to mount, which environment variables to pass.
Overview
The handful of commands you will use daily
Running a container starts it from an image with the arguments you supply: which ports to publish, which directories to mount, which environment variables to pass. Everything else is a variation on that.
Publishing a port maps a host port to a container port. Forgetting it is the reason a service that is definitely running is definitely not reachable.
Executing a shell inside a running container is the main debugging tool. Note that many minimal images have no shell at all, which is a deliberate trade-off you will meet later.
In this lesson you will:
- Run, list, and remove containers
- Publish a port and mount a directory
- Get a shell inside a running container
Resources
Notes are not saved yet — they clear when you leave this page.
Images, containers, and layers
4m
Namespaces, cgroups, and the isolation illusion
8m