Sign inSign up free

827. Unable to Locate Package, Months Later

easy 10 XP ~8 minHands-on lab

Labs have no container engine, so nothing is built: your files are checked by reading them.

Someone added git to the image of cart and the build failed:

E: Unable to locate package git

The apt-get update layer came from the build cache, months old. The image is also 150 MB bigger than it needs to be.

Task

Rewrite the package installation in /home/student/projects/cart/Dockerfile so that:

  • one RUN does all the apt work: apt-get update followed by apt-get install in that same RUN,
  • the install is non-interactive (-y) and skips recommended packages (--no-install-recommends),
  • it installs exactly ca-certificates, curl, git and python3 (ca-certificates is needed by curl once recommends are skipped),
  • the same RUN ends by deleting /var/lib/apt/lists/*.

Keep the rest of the Dockerfile.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Part of Docker Fundamentals. Next step: Copy a Tool From Its Image Instead of curl | sh

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.