Docker 1.9 allows to pass arguments to a dockerfile. See link: https://docs.docker.com/engine/reference/builder/#arg
How can i pass the same arugments within ENTRYPOINT Instruction??
My dockerfile has
ARG $Version=3.1
ENTRYPOINT /tmp/folder-$Version/sample.sh start
I am getting an error while creating container with above dockerfile. Please suggest what is the correct way to specify the argument within ENTRYPOINT instruction??
Like Blake Mitchell sais, you cannot use
ARG
inENTRYPOINT
. However you can use yourARG
as a value forENV
, that way you can use it withENTRYPOINT
:Dockerfile
Short answer: you need to use
ENV
Both
ARG
andENV
are not expanded inENTRYPOINT
orCMD
. (https://docs.docker.com/engine/reference/builder/#environment-replacement) However, becauseENV
s are passed in as part of the environment, they are available at run time, so the shell can expand them. (This means you can't use the array form ofENTRYPOINT
orCMD
.)Here is an example:
The syntax for
ARG
should omit the$
.Instead of
ARG $Version=3.1
, tryARG Version=3.1
.