title: Azure devops release pipeline - Specific docker images shared between environments
body: <p>I have a web application which I want to dockerise and release using azure pipelines.
  I'm already able to build and test but am struggling on releasing it.</p>
  
  <p><strong>Build Pipeline</strong> (on build server controlled with VSTS agent):</p>
  
  <pre><code>1) Build using .net core
  2) Run unit tests using .net core
  3) Build docker image
  4) Push to registry
  </code></pre>
  
  <p>This then automatically triggers my Release Pipeline. The release pipeline has two stages which are <code>create release</code> and <code>deploy release</code>.
  A non-docker scenario would be to create DLLs (<code>create release</code>) and deploy on web servers (<code>deploy release</code>). I'm not sure if/how this applies to docker apps.</p>
  
  <p><strong>Release Pipeline</strong> (a separate release agent running on each environment server):</p>
  
  <pre><code>Artifact (CI Build) =&gt; DEV =&gt; SIT =&gt; UAT =&gt; PROD
  </code></pre>
  
  <p>In each of the environments, I do:</p>
  
  <pre><code>1) stop and remove old image/container
  2) pull 'latest' tag from repository
  3) run new image in docker container.
  </code></pre>
  
  <p><strong>Question</strong>:
  How do I create a single, release specific, docker image which can then be pushed to each environment and how do I split the <code>create release</code> from <code>deploy release</code> to get this done?</p>
  
  <p><strong>Issues</strong>:</p>
  
  <ul>
  <li><p>If I'm just pulling an image in each pull then I'm just getting the latest tag, I am not sure if I can tag the registry image with the release number?
  The reason for tagging with a release number/name is so that I can re-deploy a previous release if necessary.</p></li>
  <li><p>I want to prevent storing all the release images on my DEV/SIT/UAT/PROD servers. The release images need to live in the registry server so that I have a central location to pull them from.</p></li>
  </ul>