title: How to authenticate Docker with VSTS?
body: <p>With a <em>self-hosted agent</em>, I m getting following error at the end of VSTS build pipeline.</p>
  
  <blockquote>
    <p>2018-10-04T12:11:10.3334402Z ##[error]unauthorized: authentication required<br>
    2018-10-04T12:11:10.3447576Z ##[error]/snap/bin/docker failed with return code: 1</p>
  </blockquote>
  
  <p>The point is I want to push Docker image to <a href="https://azure.microsoft.com/en-us/services/container-registry/" rel="nofollow noreferrer">Azure Container Registry</a>, using Docker <a href="https://marketplace.visualstudio.com/items?itemName=ms-vscs-rm.docker" rel="nofollow noreferrer">extension</a>.</p>
  
  <p>When I perform exactly <strong>same pipeline</strong> on my Ubuntu machine, where agent builds, just <strong>with Docker commands, push succeeds</strong>. Build succeeds and repository is pushed to cloud.</p>
  
  <p>How can I authenticate Docker for my build agent, to be able to push?</p>