## File: README.md

Docker Curriculum
===

> Learn to build and deploy your distributed applications easily to the cloud with Docker!

Follow the curriculum on [docker-curriculum.com](https://docker-curriculum.com/)

---

## File: starlight/src/content/docs/hello-world/00-busybox.md

---
title: Playing With Busybox
---

Now that we have everything setup, it's time to get our hands dirty. In this section, we are going to run a [Busybox](https://en.wikipedia.org/wiki/BusyBox) container on our system and get a taste of the `docker run` command.

To get started, let's run the following in our terminal:

```bash
$ docker pull busybox
```

> Note: Depending on how you've installed docker on your system, you might see a `permission denied` error after running the above command. If you're on a Mac, make sure the Docker engine is running. If you're on Linux, then prefix your `docker` commands with `sudo`. Alternatively, you can [create a docker group](https://docs.docker.com/engine/installation/linux/linux-postinstall/) to get rid of this issue.

The `pull` command fetches the busybox [**image**](https://hub.docker.com/_/busybox/) from the [**Docker registry**](https://hub.docker.com/explore/) and saves it to our system. You can use the `docker images` command to see a list of all images on your system.

```bash
$ docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
busybox                 latest              c51f86c28340        4 weeks ago         1.109 MB
```

---

## File: starlight/src/content/docs/hello-world/01-docker-run.md

---
title: Docker Run
---

Great! Let's now run a Docker **container** based on this image. To do that we are going to use the almighty `docker run` command.

```bash
$ docker run busybox
$
```

Wait, nothing happened! Is that a bug? Well, no. Behind the scenes, a lot of stuff happened. When you call `run`, the Docker client finds the image (busybox in this case), loads up the container and then runs a command in that container. When we run `docker run busybox`, we didn't provide a command, so the container booted up, ran an empty command and then exited. Well, yeah - kind of a bummer. Let's try something more exciting.

```bash
$ docker run busybox echo "hello from busybox"
hello from busybox
```

Nice - finally we see some output. In this case, the Docker client dutifully ran the `echo` command in our busybox container and then exited it. If you've noticed, all of that happened pretty quickly. Imagine booting up a virtual machine, running a command and then killing it. Now you know why they say containers are fast! Ok, now it's time to see the `docker ps` command. The `docker ps` command shows you all containers that are currently running.

```bash
$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
```

Since no containers are running, we see a blank line. Let's try a more useful variant: `docker ps -a`

```bash
$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
305297d7a235        busybox             "uptime"            11 minutes ago      Exited (0) 11 minutes ago                       distracted_goldstine
ff0a5c3750b9        busybox             "sh"                12 minutes ago      Exited (0) 12 minutes ago                       elated_ramanujan
14e5bd11d164        hello-world         "/hello"            2 minutes ago       Exited (0) 2 minutes ago                        thirsty_euclid
```

So what we see above is a list of all containers that we ran. Do notice that the `STATUS` column shows that these containers exited a few minutes ago.

You're probably wondering if there is a way to run more than just one command in a container. Let's try that now:

```bash
$ docker run -it busybox sh
/ # ls
bin   dev   etc   home  proc  root  sys   tmp   usr   var
/ # uptime
 05:45:21 up  5:58,  0 users,  load average: 0.00, 0.01, 0.04
```

Running the `run` command with the `-it` flags attaches us to an interactive tty in the container. Now we can run as many commands in the container as we want. Take some time to run your favorite commands.

> **Container Isolation & Ephemeral State**: Try creating a file inside the container shell:
> ```bash
> / # touch my_test_file.txt
> / # ls
> ```
> Now exit the container by typing `exit` and start a new container with `docker run -it busybox sh`:
> ```bash
> $ docker run -it busybox sh
> / # ls
> ```
> Notice that `my_test_file.txt` is nowhere to be found! That's because Docker creates a fresh, isolated container instance every time. Any changes made inside a container instance do not affect your host machine or subsequent container runs.

That concludes a whirlwind tour of the mighty `docker run` command, which would most likely be the command you'll use most often. It makes sense to spend some time getting comfortable with it. To find out more about `run`, use `docker run --help` to see a list of all flags it supports. As we proceed further, we'll see a few more variants of `docker run`.

Before we move ahead though, let's quickly talk about deleting containers. We saw above that we can still see remnants of the container even after we've exited by running `docker ps -a`. Throughout this tutorial, you'll run `docker run` multiple times and leaving stray containers will eat up disk space. Hence, as a rule of thumb, I clean up containers once I'm done with them. To do that, you can run the `docker rm` command. Just copy the container IDs from above and paste them alongside the command.

```bash
$ docker rm 305297d7a235 ff0a5c3750b9
305297d7a235
ff0a5c3750b9
```

On deletion, you should see the IDs echoed back to you. If you have a bunch of containers to delete in one go, copy-pasting IDs can be tedious. On Linux or macOS, you can filter and remove exited containers:

```bash
$ docker rm $(docker ps -a -q -f status=exited)
```

However, command substitution like `$(...)` differs across operating systems (such as Windows PowerShell). On modern versions of Docker across all platforms, the recommended command to clean up stopped containers is `docker container prune`:

```bash
$ docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Deleted Containers:
4a7f7eebae0f63178aff7eb0aa39f0627a203ab2df258c1a00b456cf20063
f98f9c2aa1eaf727e4ec9c0283bcaa4762fbdba7f26191f26c97f64090360

Total reclaimed space: 212 B
```

One last thing that'll be useful is the `--rm` flag that can be passed to `docker run` which automatically deletes the container once it's exited. For one-off container runs, the `--rm` flag is very handy.

Lastly, you can also delete images that you no longer need by running `docker rmi`.

---

## File: starlight/src/content/docs/hello-world/02-terminlogy.md

---
title: Terminology
---

In the last section, we used a lot of Docker-specific jargon which might be confusing to some. So before we go further, let me clarify some terminology that is used frequently in the Docker ecosystem.

- _Images_ - The blueprints of our application which form the basis of containers. In the demo above, we used the `docker pull` command to download the **busybox** image.
- _Containers_ - Created from Docker images and run the actual application. We create a container using `docker run` which we did using the busybox image that we downloaded. A list of running containers can be seen using the `docker ps` command.
- _Docker Daemon_ - The background service running on the host that manages building, running and distributing Docker containers. The daemon is the process that runs in the operating system which clients talk to.
- _Docker Client_ - The command line tool that allows the user to interact with the daemon. More generally, there can be other forms of clients too - such as [Kitematic](https://kitematic.com/) which provide a GUI to the users.
- _Docker Hub_ - A [registry](https://hub.docker.com/explore/) of Docker images. You can think of the registry as a directory of all available Docker images. If required, one can host their own Docker registries and can use them for pulling images.

---

## File: starlight/src/content/docs/hello-world/03-quiz.mdx

---
title: Quiz
---

import Quiz from '../../../components/Quiz.astro';

Test your understanding of the concepts covered in the **Hello World** chapter.

<Quiz 
  title="Chapter 3: Hello World Knowledge Check"
  questions={[
    {
      question: "In Docker terminology, what is the precise relationship between a Docker Image and a Docker Container?",
      options: [
        "An Image is a executable running process, whereas a Container is a stored zip file on disk",
        "An Image is an immutable blueprint containing code and libraries, while a Container is a runnable instance created from an image",
        "There is no difference; Image and Container are interchangeable terms for the same concept",
        "Containers exist only in cloud registries, while Images exist only on your local machine"
      ],
      correctIndex: 1,
      explanation: "Images serve as read-only blueprints (templates) of your application, whereas Containers are the isolated, runnable instances instantiated from those images."
    },
    {
      question: "Which command downloads a Docker image (such as `busybox`) from Docker Hub to your local machine without executing it?",
      options: [
        "docker pull busybox",
        "docker fetch busybox",
        "docker download busybox",
        "docker get busybox"
      ],
      correctIndex: 0,
      explanation: "The `docker pull` command fetches the specified image from a remote registry (like Docker Hub) and saves it to your local Docker image cache."
    },
    {
      question: "If you create a text file inside an interactive container shell (`docker run -it busybox sh`) and then exit, what happens when you start a new container from the same image?",
      options: [
        "The text file will automatically appear in the new container",
        "The text file will be saved to your host machine's desktop",
        "The text file will not be present because containers are isolated, fresh instances",
        "Docker will throw a file conflict error and refuse to start"
      ],
      correctIndex: 2,
      explanation: "Docker containers feature isolated, ephemeral file systems. Changes made inside one container instance do not persist into new container instances unless mounted to volumes."
    },
    {
      question: "Which flag passed to `docker run` automatically cleans up and deletes the container instance once its process completes?",
      options: [
        "--rm",
        "--clean",
        "-d",
        "--auto-delete"
      ],
      correctIndex: 0,
      explanation: "The `--rm` flag instructs Docker to remove the container and its temporary file system automatically as soon as it exits, preventing disk clutter."
    }
  ]}
/>

---

## File: starlight/src/content/docs/getting-started/00-getting-started.md

---
title: Getting Started
---

This document contains a series of several sections, each of which explains a particular aspect of Docker. In each section, we will be typing commands (or writing code). All the code used in the tutorial is available in the [Github repo](http://github.com/prakhar1989/docker-curriculum).

> Note: This tutorial uses version **18.05.0-ce** of Docker. If you find any part of the tutorial incompatible with a future version, please raise an [issue](https://github.com/prakhar1989/docker-curriculum/issues). Thanks!

---

## File: starlight/src/content/docs/getting-started/01-prerequisites.md

---
title: Prerequisites
---

There are no specific skills needed for this tutorial beyond a basic comfort with the command line and using a text editor. This tutorial uses `git clone` to clone the repository locally. If you don't have Git installed on your system, either install it or remember to manually download the zip files from Github. Prior experience in developing web applications will be helpful but is not required. As we proceed further along the tutorial, we'll make use of a few cloud services. If you're interested in following along, please create an account on each of these websites:

- [Amazon Web Services](http://aws.amazon.com/)
- [Docker Hub](https://hub.docker.com/)

---

## File: starlight/src/content/docs/getting-started/02-setting-up.md

---
title: Setting up your computer
---

Getting all the tooling setup on your computer can be a daunting task, but thankfully getting Docker up and running on your favorite OS is straightforward with [Docker Desktop](https://www.docker.com/products/docker-desktop/).

The _getting started_ guide on Docker has detailed instructions for setting up Docker on [Mac](https://docs.docker.com/desktop/install/mac-install/), [Linux](https://docs.docker.com/desktop/install/linux-install/) and [Windows](https://docs.docker.com/desktop/install/windows-install/).

> **Windows Note:** Docker Desktop on Windows uses **WSL 2** (Windows Subsystem for Linux 2) as its default backend, providing full Linux kernel compatibility and near-native speed. Ensure WSL 2 is enabled during installation.
>
> **Mac Note:** In addition to [Docker Desktop](https://docs.docker.com/desktop/install/mac-install/), macOS users can also use **[OrbStack](https://orbstack.dev/)** — a fast, lightweight alternative to Docker Desktop that starts in seconds and uses minimal CPU and battery. You can install it via Homebrew:
> ```bash
> brew install --cask orbstack
> ```
> Both Docker Desktop and OrbStack provide the standard `docker` CLI and `docker compose` out of the box.

Once you are done installing Docker, test your Docker installation by running the following in your terminal:

```bash
$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.
...
```

---

## Instant Setup with Devcontainers & GitHub Codespaces

If you prefer not to configure your local development tools manually, you can launch an instant cloud development environment via **GitHub Codespaces**, powered by the repository's `.devcontainer` configuration.

> **Zero Local Setup:** Does **not** require Docker, Node.js, Python, or any developer tools installed on your computer.

1. Open the [docker-curriculum repository on GitHub](https://github.com/prakhar1989/docker-curriculum).
2. Click the green **Code** button, select the **Codespaces** tab, and click **Create codespace on main**.
3. A full browser-based IDE will launch directly in your browser with Docker and Node pre-configured.

> **Note:** On initial creation, GitHub Codespaces may take a few minutes to build the container environment, start the Docker daemon, and finish installing dependencies.



Once your Codespace launches, test Docker directly inside the browser terminal:

```bash
$ docker run hello-world
```



> **Troubleshooting Tip:** If `docker ps` or `docker run` reports `Cannot connect to the Docker daemon`, start the Docker service manually in your Codespace terminal:
> ```bash
> sudo service docker start
> ```

---

## File: starlight/src/content/docs/getting-started/03-quiz.mdx

---
title: Quiz
---

import Quiz from '../../../components/Quiz.astro';

Test your understanding of the concepts covered in the **Getting Started** chapter.

<Quiz 
  title="Chapter 2: Getting Started Knowledge Check"
  questions={[
    {
      question: "Which official application provides the graphical dashboard, Docker Engine, CLI, and Docker Compose out of the box for Mac, Windows, and Linux?",
      options: [
        "Docker Desktop",
        "Docker Server Manager",
        "Linux Kernel Manager",
        "VirtualBox Hypervisor"
      ],
      correctIndex: 0,
      explanation: "Docker Desktop is the official application for Mac, Windows, and Linux that includes Docker Engine, CLI tools, Compose, and Kubernetes."
    },
    {
      question: "On Windows, what technology does Docker Desktop use by default as its backend for full Linux kernel compatibility and near-native speed?",
      options: [
        "WSL 2 (Windows Subsystem for Linux 2)",
        "Hyper-V Legacy Mode",
        "MS-DOS Emulation",
        "Wine Emulation Layer"
      ],
      correctIndex: 0,
      explanation: "Docker Desktop on Windows leverages WSL 2 to run a lightweight Linux utility VM, providing full Linux kernel compatibility and high performance."
    },
    {
      question: "Which command is recommended in the tutorial to test your new Docker installation and verify that everything is working correctly?",
      options: [
        "docker run hello-world",
        "docker test system",
        "docker verify install",
        "docker start engine"
      ],
      correctIndex: 0,
      explanation: "Running `docker run hello-world` pulls a tiny test image, launches a container, prints an informational welcome message, and verifies your installation."
    },
    {
      question: "Which two external cloud accounts are recommended as prerequisites for following the hands-on deployment sections of this curriculum?",
      options: [
        "Docker Hub and Amazon Web Services (AWS)",
        "GitHub and Google Cloud Platform (GCP)",
        "Microsoft Azure and DigitalOcean",
        "Heroku and Netlify"
      ],
      correctIndex: 0,
      explanation: "The tutorial utilizes Docker Hub to publish container images and Amazon Web Services (AWS Elastic Beanstalk / ECS) for cloud deployment."
    }
  ]}
/>

---

## File: starlight/src/content/docs/conclusion/00-conclusion.md

---
title: Conclusion
---

And that's a wrap! After a long, exhaustive but fun tutorial you are now ready to take the container world by storm! If you followed along till the very end then you should definitely be proud of yourself. You learned how to setup Docker, run your own containers, play with static and dynamic websites and most importantly got hands on experience with deploying your applications to the cloud!

I hope that finishing this tutorial makes you more confident in your abilities to deal with servers. When you have an idea of building your next app, you can be sure that you'll be able to get it in front of people with minimal effort.