Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying docker image for caching during ecs-init #4247

Open
ekawas-vrify opened this issue Jul 18, 2024 · 1 comment
Open

Specifying docker image for caching during ecs-init #4247

ekawas-vrify opened this issue Jul 18, 2024 · 1 comment

Comments

@ekawas-vrify
Copy link

Summary

Looking for a way to specify an image to cache in an instance that is added to a warm pool.

Description

I have noticed that some of the steps mentioned to speed up task instantiation in an ecs service require us to add variables to user_data or pull docker images so they are cached when the container transitions from Warm:Stopped to Running.

I have noticed that my docker pull commands dont seem to cache an image in a warmed ec2 host. I do see that the commands were run. I wonder if it would be possible to include an environment variable that allows us to specify the task image (or images) we would like to cache during ecs-init. Doing this would allow us to speed up tasks that use warm pools.

Expected Behavior

Observed Behavior

Environment Details

Supporting Log Snippets

@mye956
Copy link
Contributor

mye956 commented Oct 29, 2024

Hi @ekawas-vrify, thanks for opening up this github issue.

I have noticed that some of the steps mentioned to speed up task instantiation in an ecs service require us to add variables to user_data

Are you referring to the following public doc? If so, then one of the ideas is to set the ECS_IMAGE_PULL_BEHAVIOR environment variable to be the value of prefer-cached within the userdata. A bit of context for what this will do

If prefer-cached is specified, the image will be pulled remotely if there is no cached image, otherwise the cached image in the instance will be used

In other words, during task setup, agent will try to find whether or not the image is already on the host. If it isn't then it will pull the image and then store it on the host. All future tasks using the same image shouldn't need to pull down the image again as long as the image is still on the host and has not been cleaned up.

I wonder if it would be possible to include an environment variable that allows us to specify the task image (or images) we would like to cache during ecs-init

Regarding specific docker images, I don't think there's an option to do this currently and will most likely be a feature request. By setting ECS_IMAGE_PULL_BEHAVIOR to be prefer-cached, it will mean that all task images will be cached on the host. Also, ecs-Init shouldn't be the one pulling down the task images but ECS Agent as it's the service that's setting up and running the ECS Agent container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants