title: Can we pass ARG to CMD in DockerFile?
body: <p>How can i pass ENV variable while using docker run command and also Can you tell me if i'm passing the ENV variable correctly in CMD? </p>
  
  <p>Main thing which i want to achieve is that I have uploaded my code on gitlab and creating a docker image so that i can create my web application container. In that code we have a file Core.js which takes 2 arguments 1. Organization name and Port number. For that i need to run node Core.js Org1 1401, node Core.js  Org2 1402, etc.  There is a shell script which is pulled in via docker file i need to give name of that file as an argument so that it should use same docker image but i can create multiple container for different organization</p>
  
  <pre><code>FROM alpine
  
  LABEL MAINTAINER "CoE"
  WORKDIR /
  
  ARG proxy
  ARG username
  ARG pswd
  ENV ORG_SCRIPT
  
  RUN export http_proxy=$proxy                                                                    &amp;&amp; \
      export https_proxy=$proxy                                                                   &amp;&amp; \
      git clone -b master https://$username:$pswd@git.devops.company.net/dlr_ui         &amp;&amp; \
      npm install                     
  
   EXPOSE 1401 1402 1403 1404 1405 1406 1407 1408
   WORKDIR /applications/package/ui_servers 
  CMD ["sh","./${ORG_SCRIPT}"]    // It is not getting the script name over here. Can you tell if it is correct way or not. OR i should do:
  CMD ["sh","./$ORG_SCRIPT"]
  
  I'm getting error for both. Value is not coming to that variable.
  
  Buid:
   docker build --no-cache --build-arg proxy=$http_proxy --build-arg username=dfadf--build-arg pswd=dsfadsf --build-arg -t uinodetest .
  
  
  RUN:
  docker run  -d -it -p 1401:1401 -e ORG_SCRIPT runOrg1.sh --name="Org1_UI" uinodetest
  
  OR Other method i'm using is
  
  FROM alpine
  
  LABEL MAINTAINER "CoE"
  WORKDIR /
  
  ARG proxy
  ARG username
  ARG pswd
  ENV ORG_NAME
  ENV ORG_PORT
  
  RUN export http_proxy=$proxy                                                                    &amp;&amp; \
      export https_proxy=$proxy                                                                   &amp;&amp; \
      git clone -b master https://$username:$pswd@git.devops.company.net/dlr_ui         &amp;&amp; \
      npm install                     
  
   EXPOSE 1401 1402 1403 1404 1405 1406 1407 1408
   WORKDIR /applications/package/ui_servers 
  CMD ["node","Core.js","$ORG_NAME","ORG_PORT"]
  
  
  
  Buid:
   docker build --no-cache --build-arg proxy=$http_proxy --build-arg username=dfadf--build-arg pswd=dsfadsf --build-arg -t uinodetest .
  
  
  RUN:
  docker run  -d -it -p 1401:1401 -e ORG_NAME ORG1 -r ORG_PORT 1401 --name="Org1_UI" uinodetest
  </code></pre>
  
  <p>Tell me if i'm missing something or my syntax is wrong.</p>