<p>I am building an Azure DevOps pipeline using a yml file.</p>
<p>In the yml definition I have two stages, one is to build docker images , second stage is to push these images to ACR. I am able to store docker image as build artifact in the first step. I can also download build artifact into $(Pipeline.Workspace). I could not find a way to push image from $(Pipeline.Workspace) to Container registry as docker save does not have parameter to reference $(Pipeline.Workspace) workspace directory.</p>
<pre><code>- task: Docker@2
  displayName: Push Image to Repository
  inputs:
    command: push
</code></pre>

Naga Shekar
<p>You can try <a href="https://learn.microsoft.com/en-us/azure/devops/pipelines/ecosystems/containers/acr-template?view=azure-devops#how-we-build-your-pipeline" rel="nofollow noreferrer">Build and push an image to container registry</a></p>
<pre><code>- stage: Build
  displayName: Build and push stage
  jobs:  
  - job: Build
    displayName: Build job
    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>You can refer to this thread <a href="https://stackoverflow.com/questions/60234813/how-to-build-docker-image-and-push-to-azure-container-registry">How to build docker image and push to azure container registry</a></p>
