Docker Tutorial — Installation Exercises
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:
- What Docker Engine version are you running?
- What storage driver is Docker using?
- 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:
- What command shows running containers?
- What command removes unused images?
- What’s the difference between
docker psanddocker container ls?
Show Answer
docker container ls(ordocker ps)docker image prune- They’re identical —
docker psis the legacy shorthand fordocker container ls
Exercise 3 — Interactive Container
Goal: Run an interactive container and explore it.
$ docker run -it alpine sh
Inside the container:
- Run
cat /etc/os-release— what OS is it? - Run
ps aux— how many processes are running? - Run
hostname— what’s the hostname? - Type
exitto leave
Show Answer
- Alpine Linux
- Typically just 1-2 (your shell process + ps itself)
- A random container ID (e.g.,
a1b2c3d4e5f6) - 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.