title: How to pass Jenkins credentials to a Dockerfile/Shell?
body: <p>I've a Makefile with:</p>
  
  <pre><code>docker build --build-arg USER=${USER} --build-arg PASSWD=${PASSWD}
  </code></pre>
  
  <p>and I build it in a jenkins script with:</p>
  
  <pre><code>withCredentials([usernamePassword(credentialsId: 'my-credentials', passwordVariable: 'PASSWD', usernameVariable: 'USER')]) { (build_step) }
  </code></pre>
  
  <p>In a Dockerfile script, I have:</p>
  
  <pre><code>ARG USER
  
  ARG PASSWD 
  
  curl -u ${USER}:${PASSWD}
  </code></pre>
  
  <p>Where USER/PASSWD pair is passed to repo/API.</p>
  
  <p>What are necessary steps for USER / PASSWD to be passed properly? I've tried a lot of solutions/syntax options and RUN export. None seems to be working.</p>
  
  <p>Is there a way to RUN echo variables from dockerfile? Jenkins log shows either a variable name or whitespaces for most of attempts.</p>