Chapter 10
Technical Environment
Presentation & objectives
In a database course, every student needs to run services such as PostgreSQL, MySQL, Redis, ElasticSearch or MongoDB on their own machine. But students use a wide variety of systems—Windows, macOS, Linux, different versions, different configurations—which makes installing and configuring databases a time-consuming and error-prone task. Docker solves this problem by providing isolated, reproducible environments that behave the same on every computer. Instead of struggling with installers, system dependencies, port conflicts, or path issues, students can launch a fully configured database in seconds with a single command. This ensures that everyone works with identical setups, removes “it works on my machine” issues, and lets us focus on learning database concepts rather than debugging local environments.
This first section of the track thus aims to introduce all the necessary concepts to manage services deployed on top of Docker.
By the end of these activities, you will be able to:
- understand the role of Docker as a backbone of a services-based architecture,
- manipulate and create Docker image,
- run Docker containers.
In addition to these basic skills, you shall also learn more advanced and useful notions as:
- virtual networks to control network accesses to your services,
- volumes to make your data persistant.
Warning
Before attending the supervised session, you have to read :
Very useful documentations can be found here:
Activities
- Basic Docker concepts
- More advanced Docker concepts
Knowledge Check
Answer these questions once you have finished this course module.
---
primary_color: steelblue
secondary_color: lightgray
text_color: black
shuffle_questions: false
shuffle_answers: true
---
# Which statement best describes a Docker container?
1. [ ] A lightweight virtual machine with its own kernel
2. [x] A running instance of an image with an isolated filesystem and process space
3. [ ] A software package that includes only application code
4. [ ] A hypervisor-compatible execution environment
# In Docker, what does each instruction in a Dockerfile typically create?
1. [ ] A new container
2. [ ] A new image
3. [x] A new layer
4. [ ] A new network
# What is the key benefit of UnionFS in Docker images?
1. [ ] It encrypts data stored in containers
2. [x] It merges multiple layers into a single unified filesystem
3. [ ] It ensures containers have direct access to host hardware
4. [ ] It removes the need for caching during builds
# What happens when a running container modifies a file that resides in a read-only image layer?
1. [ ] The file is edited directly in the read-only layer
2. [x] Docker duplicates the file into the writable layer (copy-on-write)
3. [ ] The container is forced to restart
4. [ ] The change is discarded when the container exits
# Which Docker network type is created automatically and used by default for containers?
1. [ ] host
2. [ ] verlay
3. [ ] none
4. [x] bridge
# What is a major difference between the default bridge network and a user-defined bridge network?
1. [ ] The default bridge supports DNS-based container name resolution
2. [x] A user-defined bridge supports DNS-based container name resolution
3. [ ] The default bridge is faster than user-defined networks
4. [ ] User-defined bridges cannot be used with Docker Compose
# Which command exposes container port 80 on host port 8080?
1. [ ] docker run -p 80:8080 myimage
2. [ ] docker run -p 8080 myimage
3. [x] docker run -p 8080:80 myimage
4. [ ] docker run --expose 8080 myimage
# Why are named volumes generally recommended for databases?
1. [ ] They automatically encrypt data
2. [ ] They are easier to mount to multiple containers simultaneously
3. [x] They persist data independently of containers and avoid OS-specific paths
4. [ ] They automatically create database users and permissions
# In Docker Compose, how do services communicate with each other by default?
1. [ ] By using their container IDs
2. [x] By using their service names as hostnames
3. [ ] By sharing the host network
4. [ ] By exposing all ports to each other
# Which statement about bind mounts is TRUE?
1. [ ] They store data inside Docker’s internal storage
2. [ ] They are recommended for production database storage
3. [x] They map a host directory into the container’s filesystem
4. [ ] They cannot be used on Windows or macOS