🎓 A1Learner
🔍
0 of 50 lessons completed

What Is a Container?

A container is a running app with its own files and libraries, set apart from the rest of the machine. It is a process, not a mini-computer.

List running containers

This command lists every container that is running now.

docker ps --format "{{.Names}} {{.Image}}"

List all containers

Add -a to list stopped containers too.

docker ps -a --format "{{.Names}} {{.Image}}"

Example

docker run --name greet hello-world

Key points

  • Container: a running image, with its own files, libraries and settings.
  • A container shares the machine's operating system kernel with the host.
  • A container starts in seconds, because no new operating system boots.
  • A container stops when its main process stops.
  • Use containers to run apps apart from each other on one machine.

In this example, Docker runs the hello-world image in a container named greet. The name greet is a label for this one container. The image prints Hello from Docker! and the container stops. A later lesson lists this stopped container by name.

Note

A container is not a virtual machine. It has no guest operating system of its own.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Rust Playground

Exercise

What is a container?