Get the latest tech news

Using ARG in a Dockerfile – beware the gotcha


Using ARG in a Dockerfile - beware the gotcha 13 May 2024 | 3 min read Today I learned about the subtleties of build arguments in Dockerfile...

I spent more than a coffee's worth of time trying to understand why my custom builds of a CAP Node.js container image weren't of the CAP version I was specifying, either implicitly with the default value I'd declared in the ARG instruction in the Dockerfile, or even explicitly with the--build-arg option on the command line. The second variable CAPVER was something similar that I was using later in the build instructions (i.e. further on in the Dockerfile), to specify the particular version of CAP that I wanted to install. From a container image built using this new version of the Dockerfile, with no--build-arg options specified, we can see that the values for DEBVER and CAPVER are available after the FROM instruction:

Get the Android app

Or read this on Hacker News

Read more on:

Photo of ARG

ARG

Photo of Dockerfile

Dockerfile

Photo of gotcha

gotcha

Related news:

News photo

How The Dark Knight ARG Changed Immersive Entertainment