title: docker login to ECR via python docker SDK
body: <p>python3 along with <a href="https://docker-py.readthedocs.io/en/stable/" rel="noreferrer">https://docker-py.readthedocs.io/en/stable/</a></p>
  
  <p>I am just curious, that when I login to ecr (via aws ecr get-login) my docker deamon on my PC remembers the token and even if restart shell i can login to ECR until token expires. I can even see that in the ~/.docker/config.json file in the auths key</p>
  
  <p>Surprisingly, logging in thru python docker SDK:</p>
  
  <pre><code>ecr_client = boto3.client('ecr')
      token = ecr_client.get_authorization_token()
      username, password = base64.b64decode(token['authorizationData'][0]['authorizationToken']).decode().split(':')
      registry = token['authorizationData'][0]['proxyEndpoint']
  
      docker_client.login(
          username=username,
          password=password,
          registry=registry
      )
  
      client.pull(...)
  </code></pre>
  
  <p>leaves my docker daemon clueless of the login attempt. When i try to pull the same image via command line - I get the error 'no auth credentials'.
  What is even more weird that is when I login to ECR via command line I no longer have to authenticate via python script.</p>
  
  <p>Any idea why is that happening?</p>