Docker Basics: Getting Started with Containers

Published: (December 6, 2025 at 11:27 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

What is Docker?

Docker is an open platform for developing, shipping, and running applications. It lets you separate your applications from your infrastructure, enabling rapid software delivery. With Docker you can manage your infrastructure the same way you manage your applications.

Installing Docker

Installing Docker sets up Docker Engine (the background daemon that manages containers, similar to a lightweight VM) and the Docker CLI (command‑line interface that interacts with the Engine via its API; other tools also use this API).

Running Your First Container

Echo test

docker run busybox echo "hello world"
  • docker run: Starts a container from an image.
  • busybox: A minimal Linux image.
  • echo "hello world": Prints the message.

Docker pulls the image if it isn’t already present, runs the command once, then exits.

Interactive shell

docker run -it busybox
  • -i: Keep STDIN open.
  • -t: Allocate a pseudo‑terminal.

This gives you an interactive shell inside the container. Type exit to stop and remove the container.

Count installed packages (inside a container)

dpkg -l | wc -l
  • dpkg -l: Lists installed Debian packages.
  • | wc -l: Counts the number of lines (a minimal container typically has fewer than 100 packages).

Launch an Ubuntu container

docker run -it ubuntu

Docker pulls the Ubuntu image (if needed) and starts an interactive root shell on a bare‑bones Ubuntu system.

Install figlet inside the container

apt-get update
apt-get install -y figlet
  • apt-get update: Refreshes the package repository index.
  • apt-get install -y figlet: Installs the figlet program (creates ASCII art). The -y flag automatically answers “yes” to prompts; no sudo is needed because you are already root inside the container.

Test figlet

figlet hello

The command prints “HELLO” in large ASCII art. If figlet isn’t installed, the previous step will install it.


Containers isolate and reproduce environments consistently. Starting with docker run lets you experiment safely; exiting the container cleans up the environment. Next topics to explore: Images and Volumes.

Back to Blog

Related posts

Read more »