Docker Tutorial — Installation Exercises

1 minute read

Practice what you’ve learned about Docker installation and CLI basics.


Exercise 1 — Install and Verify

Goal: Confirm Docker is installed and working on your machine.

# Check Docker version
$ docker version

# Check Docker system info
$ docker info

# Run hello-world
$ docker run hello-world

Questions:

  1. What Docker Engine version are you running?
  2. What storage driver is Docker using?
  3. How many containers are on your system?

Exercise 2 — Explore the CLI

Goal: Discover Docker commands using --help.

# List all top-level commands
$ docker --help

# List container management commands
$ docker container --help

# List image management commands
$ docker image --help

Questions:

  1. What command shows running containers?
  2. What command removes unused images?
  3. What’s the difference between docker ps and docker container ls?
Show Answer
  1. docker container ls (or docker ps)
  2. docker image prune
  3. They’re identical — docker ps is the legacy shorthand for docker container ls

Exercise 3 — Interactive Container

Goal: Run an interactive container and explore it.

$ docker run -it alpine sh

Inside the container:

  1. Run cat /etc/os-release — what OS is it?
  2. Run ps aux — how many processes are running?
  3. Run hostname — what’s the hostname?
  4. Type exit to leave
Show Answer
  1. Alpine Linux
  2. Typically just 1-2 (your shell process + ps itself)
  3. A random container ID (e.g., a1b2c3d4e5f6)
  4. Exiting stops the container since the shell was PID 1

Exercise 4 — Docker Daemon Configuration

Question: Where does the Docker daemon read its configuration from on Linux?

Show Answer

/etc/docker/daemon.json — this file controls log drivers, storage drivers, default runtime, and other daemon-level settings.


Exercise 5 — Docker Group

Question: Why is adding your user to the docker group considered a security concern?

Show Answer

Members of the docker group can run any container, including privileged containers that have full access to the host system. This effectively gives root-equivalent access. Only add trusted users to the docker group.


← Verify Installation Docker Architecture →

Updated: