title: Tag a Docker container as latest in Azure DevOps
body: <p>I'm trying to build a Docker container and push it to Azure Container Registry. For that, I created this <code>azure-pipeline.yml</code></p>
  <pre><code># Docker
  # Build and push an image to Azure Container Registry
  # https://docs.microsoft.com/azure/devops/pipelines/languages/docker
  
  trigger:
  - main
  
  resources:
  - repo: self
  
  variables:
    # Container registry service connection established during pipeline creation
    dockerRegistryServiceConnection: '...'
    imageRepository: 'mycontainer'
    containerRegistry: 'azuk.azurecr.io'
    dockerfilePath: '$(Build.SourcesDirectory)/dockerfile'
    tag: '$(Build.BuildId)'
  
    # Agent VM image name
    vmImageName: 'ubuntu-latest'
  
  stages:
  - stage: Build
    displayName: Build and push stage
    jobs:
    - job: Build
      displayName: Build
      pool:
        vmImage: $(vmImageName)
      steps:
      - task: Docker@2
        displayName: Build and push an image to container registry
        inputs:
          command: buildAndPush
          repository: $(imageRepository)
          dockerfile: $(dockerfilePath)
          containerRegistry: $(dockerRegistryServiceConnection)
          tags: |
            $(tag)
  </code></pre>
  <p>The pipeline is working. Now, I have another Azure pipeline that build another container but the base is the first container. For this reason, in the Dockerfile in the first line I added</p>
  <pre><code>FROM azuk.azurecr.io/mycontainer
  </code></pre>
  <p>When the pipeline starts, I get an error</p>
  <blockquote>
  <p>manifest for ***/mycontainer:latest not found: manifest unknown: manifest tagged by &quot;latest&quot; is not found</p>
  </blockquote>
  <p>I can't find a way to tell the ACR that the last push is the latest version. I saw few posts  where they use the property <code>includeLatestTag</code> that doesn't exist anymore</p>
  <pre><code>- stage: Build
    displayName: Build image
    jobs:  
    - job: DockerImage
      displayName: Build and push Docker image
      steps:
      - task: Docker@1
        displayName: 'Build the Docker image'
        inputs:
          containerregistrytype: 'Container Registry'
          dockerRegistryEndpoint: 'Docker Hub'
          command: 'Build an image'
          dockerFile: '**/Dockerfile'
          imageName: '$(ImageName)'
          includeLatestTag: true
          useDefaultContext: false
          buildContext: '.'
  </code></pre>
  <p>How can I add the tag <code>latest</code> to the Docker container and push it to the Azure Container Registry via a Azure DevOps pipeline?</p>