FIT2109 Chap.6 Virtual Machines, Containers and Packages
Virtual Machines, Containers and Packages
Virtual Machines, Containers and Packages compares isolation boundaries and the ingredients of a reproducible runtime. A virtual machine includes a guest operating system above a hypervisor. A container packages an application and user-space dependencies while sharing the host kernel.
The appropriate choice depends on the required isolation and environment, not on a universal ranking.
Assignment 2 makes the runtime boundary concrete. Python packages needed by the application belong in runtime requirements, test-only tools remain separate, and external executables required by the program must be installed at the system layer.
A Dockerfile RUN instruction executes during the image build, while the default command is used when a container starts.
What this chapter covers
- 01
Virtual machines with a guest operating system
- 02
Containers sharing the host kernel
- 03
Image layers produced during the build
- 04
Build context and the files available to COPY
- 05
Runtime Python dependencies versus test tooling
- 06
System executables required by application behaviour
- 07
Layer ordering for correct and reusable builds
- 08
Command-matrix verification inside the built image
Worked example · free
Repair a runtime environment with a missing system tool
- +1Preserve the exact failing command and repository input.
- +1Use the executable-not-found diagnostic to distinguish a system tool from a Python import.
- +1Confirm whether Git is present and reachable inside the image.
- +1Install the required system package during image construction rather than adding an unrelated Python dependency.
- +1Rebuild without relying on a cache that could hide the missing step.
- +1Rerun the original command against the same repository.
- +1Run every supported command and the complete test suite to establish the runtime contract.
Key terms
- Virtual machine
- An isolated machine environment with a guest operating system above a hypervisor, including its own kernel and user space.
- Container
- An isolated process environment that packages an application and user-space dependencies while sharing the host kernel.
- Container image
- A built filesystem and configuration used to start containers. Its layers result from image-construction instructions.
- Build context
- The directory tree made available to an image build for instructions such as COPY. Ignore rules control what enters it.
- Runtime dependency
- A package or system tool required when the delivered application executes, rather than only during development or testing.
- Layer cache
- Reusable results from earlier image-build instructions. It speeds iteration but can hide an incomplete recipe during careless verification.
- Clean build
- An image construction performed without relying on inappropriate previous state, used to prove that the recipe itself creates the environment.
Virtual Machines, Containers and Packages FAQ
What is the key difference between a virtual machine and a container?
A virtual machine includes a guest operating system above a hypervisor, while a container shares the host kernel and packages the application with its user-space dependencies. That boundary affects portability, isolation and overhead.
When does a Dockerfile RUN instruction execute?
It executes while the image is being built. Its filesystem result becomes part of an image layer and may be reused from cache. It is not rerun automatically every time a container starts.
Why should test tools be separate from runtime requirements?
The delivered application should install only what it needs to run. Test tools support development and verification but can enlarge or confuse the runtime dependency contract when the application never imports them.
How do I prove a container is complete?
Run every supported application command inside the built image against a known real repository, compare expected outputs and verify system executables, paths and runtime packages. Build success alone is not enough.
Assessment move
Draw the container and virtual-machine stacks until you can name the shared and isolated layers. Take a short Dockerfile and label every instruction as build-time or start-time, then state where it reads from and what persists. Build a tiny Python command that also invokes a system executable, and test it locally and inside a slim image.
Deliberately omit the system executable, observe the diagnostic and repair the correct layer. Create a clean virtual environment and identify direct runtime packages separately from test tooling. Rebuild the image after changing source and observe which layers can be reused, then perform a clean build to prove the recipe is complete. Finish with a command matrix listing every supported operation and its container result.
The core habit is to hold the input constant while locating the missing environment layer. Add a second failure by mounting the repository at an unexpected path. Compare its diagnostic with the missing-executable case and route the repair to filesystem context rather than package installation. Record the image identifier and exact run command for each check.
This protects the evidence chain from an old local tag or a remembered mount that is absent from the documented route.
Working through Virtual Machines, Containers and Packages in FIT2109? Sia is AskSia’s AI Computer Science tutor — ask any FIT2109 Virtual Machines, Containers and Packages question and get a clear, step-by-step explanation grounded in how FIT2109 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.