First Image with Docker
Build your first Packer image with the Docker builder on ubuntu:24.04, shell provision a marker file, recover from a deliberate provisioner failure, prove the artifact with docker images, then remove the local image tag.
Lab Overview
This is the hands-on lab for Section 4 of Packer 101. You write a Docker builder template that pulls ubuntu:24.04, runs a shell provisioner that writes a marker file, commits the container to a local image, and tags it for easy proof and cleanup. You intentionally break the provisioner, read the build log, and fix it before a successful bake. No cloud account is required.
You will:
- Confirm Packer 1.16.0 and Docker Engine on the lab host
- Write docker-ubuntu.pkr.hcl with required_plugins docker ~> 1.1, commit =
true, and a shell provisioner
- Run packer init, fmt, and validate, then recover from a deliberate
provisioner failure
- Build the image, prove it with docker images and docker run, then remove
the local tag
What You'll Learn
Confirm Packer 1.16.0 and Docker Engine on the packer-host lab VM
Author a Docker HCL2 template with ubuntu:24.04, commit = true, and docker ~> 1.1
Run packer init, fmt, and validate, and recover from a failing shell provisioner
Build a local Docker image and prove the provisioned file with docker images and docker run
Remove the local Packer image tag so the host stays clean
Prerequisites
Completion of the Packer 101 Section 4 lessons on the Docker builder
Basic Linux command line (bash, reading logs)
Basic Docker vocabulary (image, container, tag)
Technologies Covered
Part of a Course
This lab is part of the Packer 101: Golden Images for AWS, Azure, and GCP course
View All CoursesChoose your plan
Simple, Transparent Pricing
Unlock full access to TeKanAid courses, labs, and bootcamps
Just exploring? Start free below. Want the full experience? Try Premium free for 7 days (card required, $0 today).
Pro
All courses, with lab scripts to run on your own machine
Renews automatically. Cancel anytime.
Final price verified at checkout.
- Full access to all courses
- Lab scripts to download and run on your own machine (hosted labs not included)
- Progress tracking
- Certificate of completion
- Community access
- Self-paced bootcamps
- Premium puzzle library not included (5 free puzzles available)
- New content access
Premium
Full access, including unlimited hosted labs
Renews automatically. Cancel anytime.
Final price verified at checkout.
- Everything in Pro
- Unlimited hands-on labs, fully hosted on TeKanAid Academy (nothing to set up)
- Full access to the puzzle library
- Lab AI Assistant
- Priority support
Prefer a single course?
Purchase individual courses for a one-time fee of $79. Full access to course content, quizzes, certificates, and community features, lab access is not included.
Browse CoursesJust exploring? Start free, no account needed
Three free ways to start. All bridge into the paid Premium catalog when you're ready.
Not ready to commit? The crash course is email-only. No academy account required.
Ready to Get Started?
Start this hands-on lab and build real-world Platform Engineering skills
Get Access Now