title: Docker tagging strategy in CI systems (GitLab)
body: <p>We are using GitLab and thus there might be some answer specific to that platform, but I think the question is equally relevant on other CI system as well.</p>
  <p>In our CI system we have a step to build a Docker image. Actually we have 2 separate jobs:</p>
  <p>The first job will build a base image that includes all the external dependencies. This job will only run if the Dockerfile has changed. Which is rare.</p>
  <p>Then we have some test jobs that use the most recent version of the base image.</p>
  <p>If that also passes we have a second job that is using the most recent base image to create an image that already includes our source code as well and the compiled versions of the code that need compilation. Till now we taged everything with “latest”, but it is not a good solution. I wonder if there are recommended ways to tag the images. Especially given that we also start to use branches and Merge-Requests (Pull Request in GitHub speak) so we have to decide how to tag the images that might have been created in a branch and what to use during the merge request?</p>
  <p>Is there a &quot;best practice&quot; for this or are there several &quot;best practices&quot;?</p>