Hands-On LabBeginner

Running Containers with docker run and kubectl

Run nginx:alpine first with docker run then with kubectl run on the same VM, and see how Kubernetes maps onto Docker concepts.

40 minEstimated time
5Guided steps
AutoVerification
IsolatedSandbox
Running Containers with docker run and kubectl

Lab overview

Most engineers meet Docker years before they meet Kubernetes, and by the time the cluster shows up the vocabulary feels alien: pods, manifests, services, controllers, kubelets. The reality is much simpler. Kubernetes runs the same OCI containers Docker does, fetched from the same image registries, with the same nginx:alpine bytes on disk. What Kubernetes adds is a scheduler that decides where containers run, a control loop that keeps them running, and a manifest format that describes the desired state instead of typing imperative flags. Everything else is a vocabulary swap.

The cleanest way to internalize that swap is to run the exact same workload twice on the exact same machine, once with docker run and once with kubectl run, and watch the verbs change while the container stays identical. In this lab, you will start a single nginx container with Docker, inspect it, and reach it through a published host port. You will then run the same nginx:alpine image as a bare Pod in a single-node kind cluster, reach it through kubectl port-forward, and reveal the implicit Pod manifest with --dry-run=client -o yaml. By the end, you will have filled in a Docker-to-Kubernetes verb map you wrote yourself, and the rest of the Kubernetes curriculum will read like a familiar language with new grammar.

Objectives

By completing this beginner lab, you will be able to:

  • Run nginx:alpine as a standalone Docker container and reach it from the host via a published port.
  • Run the same nginx:alpine image as a bare Pod in a kind cluster using kubectl run.
  • Use kubectl port-forward to reach a Pod from the host and explain why it is needed instead of -p.
  • Generate a Pod manifest with kubectl run --dry-run=client -o yaml and identify the fields docker run was setting implicitly.
  • Compare lifecycle ownership for a Docker container versus a bare Pod and recognize when each is recreated by something else.
  • Map common Docker verbs (run, ps, logs, exec, rm) to their Kubernetes equivalents in a side-by-side reference.

Who is this lab for?

This lab is designed for:

  • Engineers who have used Docker (pulled and run a few images, understand -p and docker ps) and are starting their Kubernetes journey.
  • CKAD and AZ-104 candidates with a Docker background who need a concrete mental bridge before absorbing Deployments, Services, and ConfigMaps.
  • Anyone who has watched a kubectl tutorial and wished someone would just show the same container running both ways on the same machine.

Verified against your live environment

An automated validation engine inspects your actual resources and configurations as you work. Completion means the task was performed, not multiple choice, real-world proficiency.

[CHECK] validation_activelive
Inspecting deployed resources...
Verifying configuration state...
✓ Step requirements satisfied

More labs like this

PremiumIncluded in Premium
Duration
40 min
Steps
5

Environment

Dedicated VM IDE

Every lab includes

  • Real environment, pre-credentialed
  • Automated checks on every step
  • Isolated sandbox, auto cleanup
  • AI-recommended next steps

Lab curriculum

  1. 01

    Getting Started with Kubernetes IDE

    1 automated check

  2. 02

    Run nginx alpine with Docker on the Host

    1 automated check

  3. 03

    Run the Same Container as a Pod with kubectl run

    1 automated check

  4. 04

    Reveal the Implicit Pod Manifest with dry-run

    1 automated check

  5. 05

    Fill In the Docker to Kubernetes Verb Map

    1 automated check

Skills validated

DockerKubernetes

Not the lab you were looking for?

Browse 200+ hands-on labs across AWS, Azure, Kubernetes, Docker, and cloud security.

Explore the catalog