Linux Internals: Docker Layers, Container Kernel Mechanisms, systemd, udev, apt vs Snap
Company: Canonical
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Technical Screen
These questions come from a Linux and open source interview. They check whether you understand the mechanisms underneath tools you use every day: container images and runtimes, the init system and device manager, and the ways software is installed and packaged on a Debian or Ubuntu system. Answer each part as you would aloud, with enough mechanism to show you have looked under the hood.
### Clarifying Questions
- For containers, should the answer assume Docker on Linux with its default overlay storage driver, or any OCI-compatible runtime?
- Should the packaging answer focus on Debian packages, snaps, or both?
- Is the target system Ubuntu, where apt and snap are both available by default?
### Part 1 — Docker image layers and the kernel features containers rely on
What is a layer in a Docker image, and how do the layers become the filesystem a running container sees? Which Linux kernel mechanisms does a container depend on, and what does each one contribute?
```hint Follow a write
Ask what happens on disk when two images share the same base, and what happens when a process inside a container modifies a file that came from the image.
```
```hint See, use, call
Sort the kernel features by what they limit: what a process can see, how much it can use, and which privileged operations it can still request.
```
#### What This Part Should Cover
- Layers as ordered, read-only, content-addressed filesystem changes, combined by a union mount with a writable layer on top and copy-on-write
- How layer order affects build caching, image size and sharing between images
- The namespaces and cgroups that provide isolation and resource limits, and the extra hardening on top
- The consequence of every container sharing the host kernel
### Part 2 — systemd and udev
What are systemd and udev? What does each do, and how do they work together during boot and when a device is plugged in?
```hint Who reacts to what
One of them is the first user-space process; the other listens for kernel events about devices. Trace how a newly attached disk gets a device node and can then trigger a service.
```
#### What This Part Should Cover
- systemd as PID 1 and service manager: units, dependencies and ordering, parallel startup, cgroup tracking, logging
- udev as the device manager: kernel uevents, rules, device nodes, stable symlinks and permissions
- How device events surface as systemd device units that services can depend on
### Part 3 — Installing software, apt versus snap, and packaging
How do you install software on an Ubuntu system? What is the difference between apt and snap? Have you packaged software yourself, and what does building a package involve?
```hint Where the libraries come from
Compare the two formats by where each gets its dependencies, who decides when it updates, and what the installed program is allowed to access.
```
#### What This Part Should Cover
- The installation routes and what apt and dpkg each do, including dependency resolution and signed repositories
- A grounded apt versus snap comparison: shared versus bundled dependencies, confinement, update and rollback model, size and startup cost
- The concrete steps and files involved in building a Debian package or a snap
### What a Strong Answer Covers
- Mechanisms named precisely (overlay copy-on-write, specific namespaces, cgroup controllers, uevents) rather than buzzwords
- A clear statement of what containers do and do not isolate compared with a virtual machine
- An accurate division of labor between systemd and udev and how they connect
- A balanced packaging comparison with trade-offs, not a preference
- Commands or files you would actually use to inspect or build each piece
### Follow-up Questions
- How does a container differ from a virtual machine, and when would you choose a virtual machine instead?
- Why can moving one instruction in a Dockerfile make rebuilds much faster or slower?
- A service fails at boot because the disk it needs is not ready yet. How would you express that dependency in systemd?
- How does a classic-confinement snap differ from a strictly confined one, and why do some snaps need it?
Overview: A Linux and open source interview question set covering what a Docker image layer is, which kernel mechanisms containers rely on, what systemd and udev do and how they interact, and how apt and snap packages differ. It tests whether a candidate understands the mechanics beneath everyday Linux tools and how software is packaged.
Read the full Canonical Software Engineer interview experience this question came from