Library › Cybersecurity AI › Software developers

Check a Dockerfile against your container baseline

  • For Software developers
  • You practice Setting limits and rules
  • Time about 5 minutes

About this exercise

Review this Dockerfile against your team's container baseline: pinned base image version (no 'latest'), no secrets in ENV or ARG, the app doesn't run as root, and only the app's port is exposed. List only the lines that break the baseline, numbered, as 'line N: problem -> fix', in line order. Plain text, under 80 words.

Common mistakes when you ask AI for this

  • Not giving the baseline. The AI suggests every Docker best practice it knows, like healthchecks and image scanning. Try: Paste the baseline and say: "Only flag what breaks it."
  • Missing what isn't there. The AI reviews lines that exist and forgets the missing USER line. Try: Add: "Check whether the app runs as root."
  • Vague fixes. The AI says 'avoid secrets' without how. Try: Show the shape: "line N: problem -> fix."
  • Trusting the AI to count words. AI is bad at counting. Ask for "under 80 words" and it often lands well over. Try: Ask for less than the limit and cap each line: "each line under 15 words, under 60 words total."
  • Letting markdown in. AI adds bold and headings by default, and in the PR comment they show up as stray symbols. Try: Add: "Plain text only, no bold, no headings."

What a strong prompt includes

  • Gives the baseline
  • Lists only failures
  • Shows the line shape
  • Sets a word limit
  • Asks for plain text

Practice this now ↑

Related exercises