# Authenticate ECR via Docker Remote API

**URL:** <https://forums.docker.com/t/authenticate-ecr-via-docker-remote-api/63799>\
**Category:** General\
**Created:** [November 27, 2018, 3:35pm UTC](https://forums.docker.com/t/authenticate-ecr-via-docker-remote-api/63799 "2018-11-27T15:35:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![devashish2910](https://avatars.discourse-cdn.com/v4/letter/d/4da419/32.png) [@devashish2910](https://forums.docker.com/u/devashish2910)\
**Post date:** [November 27, 2018, 3:35pm UTC](https://forums.docker.com/t/authenticate-ecr-via-docker-remote-api/63799/1 "2018-11-27T15:35:04Z")

</div>

I need to login to my `AWS ECR` repository so it can pull whatever images it needs by using API. I need to translate what `aws ecr get-login --no-include-email --registry-ids <registry_id>` command does using Docker Remote API.

For example –

**[Solved]** API call needs to be made to AWS in order to get login credentials for docker  
- API call for this will give me `base64encoded` string which has `username` and `password`  
 **How to use those `AWS creds` in a docker login API (by using [Docker Remote API](https://docs.docker.com/engine/api/v1.37/#operation/SystemAuth)) call??  
- equivalent to `docker login -u AWS -p <password> <server_address>`)??**

I’m tried to make some `cURL` requests for the `Docker Login`. Now I’m blue in the face but this request doesn’t give me any response. Please show me where I’m wrong. ☹

```auto
curl --unix-socket /var/run/docker.sock -d
'{
"username":"AWS",
"serveraddress":"https://<registry_id>.dkr.ecr.us-west-2.amazonaws.com",
"password": "<password_from_above_response>"
}'
-X POST http:/v1.37/auth

```

```auto
curl --unix-socket /var/run/docker.sock -d
'{
"username":"AWS",
"serveraddress":"https://<registry_id>.dkr.ecr.us-west-2.amazonaws.com",
"password": "<password_from_above_response>"
}'
-X POST http:/v1.24/auth

```

```auto
curl --unix-socket /var/run/docker.sock -d
'{
"username":"AWS",
"serveraddress":"https://<registry_id>.dkr.ecr.us-west-2.amazonaws.com",
"password": "<password_from_above_response>"
}'
-X POST http:/localhost/auth

```

```auto
curl --unix-socket /var/run/docker.sock -d
'{
"username":"AWS",
"serveraddress":"https://<registry_id>.dkr.ecr.us-west-2.amazonaws.com",
"password": "<password_from_above_response>"
}'
-X POST http/auth

```

```auto
curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" -d
'{
"username":"AWS",
"serveraddress":"https://<registry_id>.dkr.ecr.us-west-2.amazonaws.com",
"password": "<password_from_above_response>"
}'
-X POST http/auth

```
