<p>We have created a sqlhost file in gitrepo along with dockerfile, kubernetes yaml file and jenkinsfile,each time I have to manually add entry in sqlhost file which later dockerfile takes the value from sqlhost
Is there a way from jenkins which can pass value as a parameter to dockefile and then build dockefile</p>

Girish Reddy
<p>You can use an <code>ARG</code> or an <code>ENV</code> instruction to specify variables that are needed to be available to the Dockerfile</p>

<p><strong>ARG</strong>: Sample dockerfile</p>

<pre><code>FROM ubuntu
ARG SQLHOST 
</code></pre>

<p>Here  you can see the SQLHOST Argument is provided in dockerfile, and while buiding specify as</p>

<pre><code>$ docker build --build-arg SQLHOST=prod-vm.example.com .
</code></pre>

<p>also you can use specify same in Jenkins configuration.</p>

<p><strong>ENV</strong>: Sample dockerfile</p>

<pre><code>FROM ubuntu
ENV SQLHOST defaultHost
</code></pre>

<p>Here  you can see the SQLHOST Environment variable is provided in dockerfile, and while buiding specify as</p>

<pre><code>$ set SQLHOST=prod-vm.example.com; docker build .
</code></pre>

<p>also you can use specify same in Jenkins configuration.</p>
