[ECS-Fargate] [request]: Wrong image ID from task metadata API on Fargate 1.4.0
- Dominant language
- Shell
- Stars
- 5.4k
- Forks
- 334
- PR merge metrics
- No merged PRs in 30d
Description
### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
**Tell us about your request**
Trying to obtain a container image ID via the [task metadata API](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-metadata-endpoint-v3.html) (**this issue is valid for both v3 and v4**) returns the image digest in Fargate 1.4.0 and the image ID in Fargate 1.3.0
**Which service(s) is this request for?**
Fargate
**Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?**
I want to know what is the image ID of a running container.
For example I'm running a task with the following image: `cdue/webconsole`
Running this image locally, yields the following details:

As you can see the image ID is: `sha256:eeac0dc626d85ba4b1e35fe312fbfb66cc9839d119432ed8754f4b88f9ae3e24`
And the image digest is: `sha256:5729a341c47697bec375303244ab88c4eab479354e2bfa0dce54c15a88bc5a85`
### Fargate 1.3.0
When querying the metadata API, I get the following response:
```
curl ${ECS_CONTAINER_METADATA_URI}
```
**Returns the correct image ID:**
```
{"DockerId":"e9c43edd...", ... "Image":"cdue/webconsole","ImageID":"sha256:eeac0dc626d85ba4b1e35fe312fbfb66cc9839d119432ed8754f4b88f...
```
### Fargate 1.4.0
I get the following response which is **the image digest and not image ID**:
```
{"DockerId":"4095a38c..."...,"Image":"cdue/webconsole","ImageID":"sha256:5729a341c47697bec375303244ab88c4eab479354e2bfa0dce54c15a88bc5a85"....
```
I would suggest that maybe the task metadata API should return both the image ID and the image digest.
Currently I cannot access the image ID for Fargate 1.4.0 tasks at all.
**Are you currently working around this issue?**
I cannot solve this issue properly. I've tried working with the digest but since it is not a UUID I cannot count on it - I believe it is mandatory to have the image ID exposed.
Contributor guide
Research direction
Start by reproducing the task metadata API responses with curl on Fargate 1.3.0 and 1.4.0, checking both metadata API v3 and v4. Compare the ImageID value with the image ID and digest shown for cdue/webconsole. Done means the service behavior or its supported response is clarified and the image ID is accessible as requested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100