21/53
Sign inSign up free

841. ADD or COPY?

medium 20 XP ~9 minHands-on lab

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

A review of the geo-lookup Dockerfile flagged every ADD: "use COPY". But one of them must extract an archive, and another downloads a binary from the internet without any verification.

Task

In /home/student/projects/geo-lookup/Dockerfile:

  • use COPY for the plain directory config/ and the script scripts/start.sh (same destinations),
  • keep ADD for vendor.tar.gz: it must still be extracted into /opt/vendor/,
  • keep ADD for the remote binary, but make the build verify it with --checksum (the expected SHA-256 is in tool.sha256) and make it executable with --chmod=755, so the RUN chmod disappears,
  • keep the CMD.

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.

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.