Containerization packages an application and its runtime dependencies into an image, then starts isolated processes as containers. On Linux, containers share the host kernel; Docker Desktop generally runs Linux containers inside a VM on Windows or macOS. Containers are not full virtual machines, and isolation is not equivalent to a security guarantee.
Browser-based DevOps simulations. Commands, interfaces, logs and infrastructure states are illustrative; no Jenkins, Docker, Git hosting or Kubernetes operation is executed.
1. Virtual machine versus container
A virtual machine has its own guest OS kernel, whereas Linux containers use the kernel of the Linux environment hosting them. Images package user-space binaries, not a separate kernel for each container. Startup and overhead depend on workload and platform.
Why this example? Compare two teaching architectures for the same Java app.
Before you run: Choose a scenario and use Next step or Play. Read the diagram, command/configuration panel and simulated interface together. Code fragments require the indicated tools or existing project.
Concept flowchart
Swipe diagram horizontally if needed to read every label.
The diagram shows possible execution paths and expected outcomes. Blue identifies the current step, green marks completed operations, and red marks failure paths.
Current stepSelected path / resultDecision
Architecture view Live teaching state
Why this step happens
See all steps in this scenario
Commands and configuration
Simulated terminal outputConsole
Data operationsCompact blocks
CurrentResultError / rejected
Execution details
Change inputs and step through the example. Simulated output. Exact logs, versions and UI appearance vary by installation.
What this animation explains
A virtual machine has its own guest OS kernel, whereas Linux containers use the kernel of the Linux environment hosting them. Images package user-space binaries, not a separate kernel for each container. Startup and overhead depend on workload and platform.
Try and observe
Trace the different layer responsibilities without treating illustrative resource figures as benchmarks.
2. Image to running container
An image is a read-only template made of filesystem layers and metadata. Docker creates a container with its own writable layer and launches a configured process. Stopping the process does not delete the image.
Why this example? Run an image present locally or one that must first be downloaded.
Before you run: Choose a scenario and use Next step or Play. Read the diagram, command/configuration panel and simulated interface together. Code fragments require the indicated tools or existing project.
Concept flowchart
Swipe diagram horizontally if needed to read every label.
The diagram shows possible execution paths and expected outcomes. Blue identifies the current step, green marks completed operations, and red marks failure paths.
Current stepSelected path / resultDecision
Architecture view Live teaching state
Why this step happens
See all steps in this scenario
Commands and configuration
Simulated terminal outputConsole
Data operationsCompact blocks
CurrentResultError / rejected
Execution details
Change inputs and step through the example. Simulated output. Exact logs, versions and UI appearance vary by installation.
What this animation explains
An image is a read-only template made of filesystem layers and metadata. Docker creates a container with its own writable layer and launches a configured process. Stopping the process does not delete the image.
Try and observe
Notice how local availability changes the pull path.
3. Package a Java application
A Spring Boot executable JAR can be copied into a Java runtime image. The Dockerfile identifies base image, working directory, copy source and default command. Java class files must be compatible with the selected runtime.
Why this example? Compare Java 21 runtime against an older Java 17 runtime for a JAR built with Java 21.
Before you run: Choose a scenario and use Next step or Play. Read the diagram, command/configuration panel and simulated interface together. Code fragments require the indicated tools or existing project.
Concept flowchart
Swipe diagram horizontally if needed to read every label.
The diagram shows possible execution paths and expected outcomes. Blue identifies the current step, green marks completed operations, and red marks failure paths.
Current stepSelected path / resultDecision
Architecture view Live teaching state
Why this step happens
See all steps in this scenario
Commands and configuration
Simulated terminal outputConsole
Data operationsCompact blocks
CurrentResultError / rejected
Execution details
Change inputs and step through the example. Simulated output. Exact logs, versions and UI appearance vary by installation.
What this animation explains
A Spring Boot executable JAR can be copied into a Java runtime image. The Dockerfile identifies base image, working directory, copy source and default command. Java class files must be compatible with the selected runtime.
Try and observe
Inspect the container exit reason rather than assuming image creation guarantees app startup.
4. Container isolation and resource limits
Namespaces isolate process views and cgroups can constrain resources. A memory limit bounds memory charged to a container; exceeding it can lead to OOM termination. The same application may need more memory than a tiny limit.
Why this example? Compare simulated workload peak 180 MiB with two configured limits.
Before you run: Choose a scenario and use Next step or Play. Read the diagram, command/configuration panel and simulated interface together. Code fragments require the indicated tools or existing project.
Concept flowchart
Swipe diagram horizontally if needed to read every label.
The diagram shows possible execution paths and expected outcomes. Blue identifies the current step, green marks completed operations, and red marks failure paths.
Current stepSelected path / resultDecision
Architecture view Live teaching state
Why this step happens
See all steps in this scenario
Commands and configuration
Simulated terminal outputConsole
Data operationsCompact blocks
CurrentResultError / rejected
Execution details
Change inputs and step through the example. Simulated output. Exact logs, versions and UI appearance vary by installation.
What this animation explains
Namespaces isolate process views and cgroups can constrain resources. A memory limit bounds memory charged to a container; exceeding it can lead to OOM termination. The same application may need more memory than a tiny limit.
Try and observe
Identify the limit that allows the assumed workload to run.
5. Container data and persistent storage
Changes to the container writable layer survive stop and start but normally disappear when the container is removed. Named volumes are managed independently and can be attached to a replacement. Do not confuse container deletion with volume deletion.
Why this example? Write a teaching file, remove the container and recreate it with or without a volume.
Before you run: Choose a scenario and use Next step or Play. Read the diagram, command/configuration panel and simulated interface together. Code fragments require the indicated tools or existing project.
Concept flowchart
Swipe diagram horizontally if needed to read every label.
The diagram shows possible execution paths and expected outcomes. Blue identifies the current step, green marks completed operations, and red marks failure paths.
Current stepSelected path / resultDecision
Architecture view Live teaching state
Why this step happens
See all steps in this scenario
Commands and configuration
Simulated terminal outputConsole
Data operationsCompact blocks
CurrentResultError / rejected
Execution details
Change inputs and step through the example. Simulated output. Exact logs, versions and UI appearance vary by installation.
What this animation explains
Changes to the container writable layer survive stop and start but normally disappear when the container is removed. Named volumes are managed independently and can be attached to a replacement. Do not confuse container deletion with volume deletion.
Try and observe
Check the file after recreation.
6. Application stack with Docker Compose
Compose describes related containers, networks and volumes in one YAML file. A service name is resolvable on its Compose network. Startup ordering alone is not a guarantee of application readiness; health checks and retry logic may be necessary.
Why this example? Compare a backend ready and backend still initializing.
Before you run: Choose a scenario and use Next step or Play. Read the diagram, command/configuration panel and simulated interface together. Code fragments require the indicated tools or existing project.
Concept flowchart
Swipe diagram horizontally if needed to read every label.
The diagram shows possible execution paths and expected outcomes. Blue identifies the current step, green marks completed operations, and red marks failure paths.
Current stepSelected path / resultDecision
Architecture view Live teaching state
Why this step happens
See all steps in this scenario
Commands and configuration
Simulated terminal outputConsole
Data operationsCompact blocks
CurrentResultError / rejected
Execution details
Change inputs and step through the example. Simulated output. Exact logs, versions and UI appearance vary by installation.
What this animation explains
Compose describes related containers, networks and volumes in one YAML file. A service name is resolvable on its Compose network. Startup ordering alone is not a guarantee of application readiness; health checks and retry logic may be necessary.
Try and observe
Notice why a started container may not yet serve requests.
Command and configuration reference
Use these commands and settings with the corresponding installed tools in a disposable practice environment.
Compare two teaching architectures for the same Java app.
docker run --rm hello-world
Image to running container — Run an image present locally or one that must first be downloaded.
FROM eclipse-temurin:21-jre
Compare Java 21 runtime against an older Java 17 runtime for a JAR built with Java 21.
docker run --memory=128m --name demo-lab demo:1
Container isolation and resource limits — Compare simulated workload peak 180 MiB with two configured limits.
docker run --name data-lab alpine sh -c "echo hello > /tmp/note"
Container data and persistent storage — Write a teaching file, remove the container and recreate it with or without a volume.
services:
Compare a backend ready and backend still initializing.
Worked practical examples
Follow the procedures in an isolated practice environment. Configuration snippets may require an existing project, build tools, credentials, images or cluster objects as indicated.
1. Run and inspect a one-shot container
Procedure
Install and start Docker Engine or Docker Desktop.
Run hello-world and inspect images and all containers.
Compare --rm with a named exited container.
Code / configuration
docker run --rm hello-world
docker run --name hello-lab hello-world
docker ps -a
docker image ls
Expected result: One-shot containers exit; --rm removes only the first container automatically.
2. Keep data in a named volume
Procedure
Create a dedicated volume.
Write a file from one Alpine container and read it from another.
Inspect the retained named volume.
Code / configuration
docker volume create notes-lab
docker run --rm -v notes-lab:/data alpine sh -c "echo hello >/data/note"
docker run --rm -v notes-lab:/data alpine cat /data/note
Expected result: The second container prints hello.
Predict the outcome before you run
Try answering these questions, then expand each answer and repeat the appropriate simulation.
1. Predict the final state for Container in “Virtual machine versus container”. Which operation explains it?
Run Java as container process Result: java -version output.
2. Predict the final state for Not cached in “Image to running container”. Which operation explains it?
Remove exited container with --rm Result: Image retained.
3. Predict the final state for Java 17 in “Package a Java application”. Which operation explains it?
Use compatible runtime and rebuild Result: Container exited.
Hands-on practice and assessment
Hands-on challenge
Install Docker in a practice environment and compare running nginx, stopping it, recreating it and keeping files in a named volume.
Edit this command/configuration scratchpad. Review prerequisites and run only in your own isolated practice environment; the browser never executes commands.
Quick assessment
Official documentation
Use the documentation for your installed tool versions and platform.
Use a local disposable practice environment and verify the active context, account, repository and names before running commands. Examples use Java 21, Maven 3.9, Jenkins Pipeline, Docker Engine and standard Kubernetes APIs. Logs and interfaces are educational reconstructions; versions, permissions, resources and real results can differ. No real deployments, credentials or network operations run in this page.