# ARG vs. ENV

> What is the difference between ARG and ENV in a Dockerfile, and when should you use each?

Canonical: https://www.internhack.in/learn/interview/docker-containers/docker-build-args-vs-env
Last updated: 2026-11-28

Difficulty: Intermediate

## Question

What is the difference between ARG and ENV in a Dockerfile, and when should you use each?

*The full answer is for InternHack members. Open the page link above to read it.*

## Concepts covered

ARG, ENV, Build-time variables, Runtime environment, Build secrets

Previous: [Inspecting Network](https://www.internhack.in/learn/interview/docker-containers/docker-inspect-network) · Next: [Docker Diff](https://www.internhack.in/learn/interview/docker-containers/docker-diff-command) · [All of Docker & Containers](https://www.internhack.in/learn/interview/docker-containers)

## More Docker & Containers questions

- [Save vs. Export](https://www.internhack.in/learn/interview/docker-containers/docker-save-vs-export)
- [Docker Top](https://www.internhack.in/learn/interview/docker-containers/docker-top-command)
- [Pruning Volumes](https://www.internhack.in/learn/interview/docker-containers/docker-volume-prune)
- [Copying Files](https://www.internhack.in/learn/interview/docker-containers/docker-cp-command)
- [Docker Commit](https://www.internhack.in/learn/interview/docker-containers/docker-commit-command)
- [Image History](https://www.internhack.in/learn/interview/docker-containers/docker-history-command)

## Related

- [Learn](https://www.internhack.in/learn)
- [Interview Prep](https://www.internhack.in/learn/interview)
- [Docker & Containers](https://www.internhack.in/learn/interview/docker-containers)
