From the course: Learning Docker Compose

Unlock the full course today

Join today to access over 24,600 courses taught by industry experts.

Build arguments

Build arguments

- [Instructor] Build arguments and environment variables are both powerful features that make Docker builds more flexible. Environment variables in Docker are visible from inside the running container. Build arguments, on the other hand, are a type of environment variable that are available to Docker only at build time, but not inside the container. Build arguments are useful for things like specifying a version for a certain build tool or cloud platform configuration. A common example I've seen is a build argument specifying the region for a cloud service provider like AWS. If a Docker container is hosted in multiple regions, for example, it becomes easy to switch between regions while still using the same singular Docker file. To specify a build argument in the Docker Compose YAML file I first have to change the build path syntax from the shorthand to a more explicit syntax. The Docker build path value, which in the…

Contents