HANDS-ON TASK · 1 OF 1

Optimize, publish, and operate

Project: Optimize, publish, and operate

You're a DevOps engineer at esc bash. A small Go reporting tool is ready to ship, and it is your job to get it production-ready: make the image lean, publish it to a registry, run it safely under a resource limit, and record what Docker is consuming on the host.

Set up the project

Run this first. It creates /root/report-tool with the app source:

bash
curl -fsSL https://raw.githubusercontent.com/Esc-Bash/project-init-scripts/main/docker/project-3/init.sh | bash

This drops in main.go (which prints report ready) and a go.mod. Do not change them.

What to do

  1. Optimize. Write a multi-stage Dockerfile in /root/report-tool: a build stage on golang:1.22-alpine that compiles the binary, and a small final stage (such as alpine) that copies the binary over with COPY --from and runs it. Build and tag it report-tool:1.0. It must run and print report ready, and the final image must be under 50 MB.
  2. Publish. Run a local registry with the registry:2 image on port 5000. Tag your image localhost:5000/report-tool:1.0 and push it.
  3. Operate under a limit. Run a container from the pushed image localhost:5000/report-tool:1.0 with a memory limit.
  4. Record usage. Save Docker's disk-usage summary into /root/ops/usage.txt.

Every step here was covered in the multi-stage, registry, debugging, and cleanup topics.

Press Submit when all four are done.

Start the lab on the right to run checks.

Pass the checks to continue
Spin up a fresh environment and practice live.
docker · fresh machine · ready in under a minute