title: When I execute docker build commands on Azure Devops YAML pipeline, an ARG specified in my Dockerfile does not appear to work
body: <p>Here is the script that I am running as part of my YAML pipeline:</p>
  
  <pre><code>- script: |
  cd ./Server
  ECHO ON
  docker build -t image_name" -f path/to/Dockerfile --build-arg BUILD_VERSION=%COMPUTED_BUILD_VERSION% .
  </code></pre>
  
  <p>And here is the output from the script as it runs in Azure Devops:</p>
  
  <pre><code>D:\a\1\s\Server&gt;docker build -t "image_name" -f path/to/Dockerfile --build-arg BUILD_VERSION=2018.12101 .
  </code></pre>
  
  <p>In particular, note that the %COMPUTED_BUILD_VERSION% environment variable is being passed in to the docker build command.</p>
  
  <p>The Dockerfile looks like this:</p>
  
  <pre><code>FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
  ARG BUILD_VERSION
  RUN ECHO Building Service version %BUILD_VERSION%
  RUN ECHO Building Service version $BUILD_VERSION
  RUN ECHO Building Service version ${BUILD_VERSION}
  </code></pre>
  
  <p>And the output in Azure DevOps looks like this:</p>
  
  <pre><code>Sending build context to Docker daemon  101.4MB
  Step 1/20 : FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
  2.1-aspnetcore-runtime: Pulling from microsoft/dotnet
  bce2fbc256ea: Already exists
  6f2071dcd729: Pulling fs layer
  85e382cad9c1: Pulling fs layer
  354ed5b87a30: Pulling fs layer
  4f039533731a: Pulling fs layer
  96e328ca2eac: Pulling fs layer
  4975b2dddfe9: Pulling fs layer
  4f039533731a: Waiting
  96e328ca2eac: Waiting
  4975b2dddfe9: Waiting
  354ed5b87a30: Verifying Checksum
  354ed5b87a30: Download complete
  85e382cad9c1: Verifying Checksum
  85e382cad9c1: Download complete
  96e328ca2eac: Verifying Checksum
  96e328ca2eac: Download complete
  4975b2dddfe9: Verifying Checksum
  4975b2dddfe9: Download complete
  4f039533731a: Verifying Checksum
  4f039533731a: Download complete
  6f2071dcd729: Verifying Checksum
  6f2071dcd729: Download complete
  6f2071dcd729: Pull complete
  85e382cad9c1: Pull complete
  354ed5b87a30: Pull complete
  4f039533731a: Pull complete
  96e328ca2eac: Pull complete
  4975b2dddfe9: Pull complete
  Digest: sha256:dcb2b8ad624a07f7acc3dc7eb4d8dcc8fb5870d5d86c74aec61a7b1545e60920
  Status: Downloaded newer image for microsoft/dotnet:2.1-aspnetcore-runtime
   ---&gt; 3e1675085dc5
  Step 2/20 : ARG BUILD_VERSION
   ---&gt; Running in 569b03e478fe
  Removing intermediate container 569b03e478fe
   ---&gt; fd3325df3c1d
  Step 3/20 : RUN ECHO Building Service version %BUILD_VERSION%
   ---&gt; Running in 7d6a8e6b1c8b
  Building
  Service
  version
  %BUILD_VERSION%
  Removing intermediate container 7d6a8e6b1c8b
   ---&gt; cfb5403a8e41
  Step 4/20 : RUN ECHO Building version $BUILD_VERSION
   ---&gt; Running in 4731418f8d80
  Building
  Service
  version
  Removing intermediate container 4731418f8d80
   ---&gt; 6ca6bfbf85e4
  Step 5/20 : RUN ECHO Building Service version ${BUILD_VERSION}
   ---&gt; Running in 3e1bfbdfbf94
  Building
  Service
  version
  </code></pre>
  
  <p>Note that I simply CANNOT seem to get the Azure DevOps pipeline to recognize or print out the Dockerfile ARG parameter properly.  This is an issue because later in the Dockerfile (which I have omitted) the variable is used as an input to another step, which ends up failing.</p>
  
  <p>Does anyone know how to make this work?  I feel like I must be missing something simple...</p>