Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does |1 mean in Docker history

Tags:

docker

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
like image 486
Sander Verhagen Avatar asked Dec 24 '16 08:12

Sander Verhagen


1 Answers

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.
The ARG instruction lets Dockerfile 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"
]
like image 113
VonC Avatar answered Oct 23 '22 03:10

VonC