Given this Dockerfile
:
FROM debian:8.3
ARG TEST=123
RUN echo $TEST
What does the |1
represent in the Docker history?
$ docker history 2feee0d8320f
IMAGE CREATED CREATED BY SIZE COMMENT
2feee0d8320f About a minute ago |1 TEST=123 /bin/sh -c echo $TEST 0 B
ac4872d0de0b About a minute ago /bin/sh -c #(nop) ARG TEST=123 0 B
f50f9524513f 9 months ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B
<missing> 9 months ago /bin/sh -c #(nop) ADD file:b5391cb13172fb513d 125.1 MB
As shown in this issue, this represents a build-arg (ie the number of args used by to build the image)
A good example is
http_proxy
or source versions for pulling intermediate files.
TheARG
instruction letsDockerfile
authors define values that users can set at build-time using the--build-arg
flag:
$ docker build --build-arg HTTP_PROXY=http://10.20.30.2:1234 .
This flag allows you to pass the build-time variables that are accessed like regular environment variables in the RUN instruction of the Dockerfile.
Here's an example of build args going through 1.10+:
[
"|4 a=1 b=2 c=3 d=4 /bin/sh -c echo $a $b $c $d"
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With