I'm having some trouble with passing argument value to dockerfile.
Running docker in Windows Server 2016
My docker version info is
PS C:\Users\Administrator\Desktop> docker version
Client: Docker Engine - Enterprise
 Version:           19.03.4
 API version:       1.40
 Go version:        go1.12.10
 Git commit:        9e27c76fe0
 Built:             10/17/2019 23:42:50
 OS/Arch:           windows/amd64
 Experimental:      false
Server: Docker Engine - Enterprise
 Engine:
  Version:          19.03.4
  API version:      1.40 (minimum version 1.24)
  Go version:       go1.12.10
  Git commit:       9e27c76fe0
  Built:            10/17/2019 23:41:23
  OS/Arch:          windows/amd64
  Experimental:     false
and powershell opened as administrator.
My reference is this.
But it not worked for me.
So this is my dockerfile.
FROM microsoft/iis
ARG a_version
RUN echo $a_version
Also i tried many different types of echo value Such as
RUN echo "$a_version"
RUN echo ${a_version}
RUN echo "${a_version}"
And this is my execute command.
docker build . --build-arg a_version=1234
My expected result was print 1234
But actual result was
PS C:\Users\Administrator\Desktop> docker build . --build-arg a_version=1234
Sending build context to Docker daemon  14.04MB
Step 1/3 : FROM microsoft/iis
 ---> 595015675977
Step 2/3 : ARG a_version
 ---> Running in 91698d9e71da
Removing intermediate container 91698d9e71da
 ---> 2bad94a2ce74
Step 3/3 : RUN echo $a_version
 ---> Running in 3fe25ecb813c
$a_version
Why it happens? How can is fix it?
 
     
    