advancedTop 100 Interview Questions

What is the difference between ARG and ENV?

ARG defines a build-time-only variable, available during the build but not present in the final running container unless explicitly assigned to an ENV variable. ENV sets a variable that's baked into the image and available both at build time and to the running container.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Why is instruction order important for build cache efficiency?← Back to all Docker questions