-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Hi there 👋,
Thanks for the great work on testcontainers-ruby!
Currently, the #start method internally uses:
`Docker::Image.create(...)´
This approach always tries to pull the image from a remote registry, which can be problematic when I’ve built an image locally using:
image_name = "my-name:latest"
Docker::Image.build_from_dir('.', { "t" => image_name, "dockerfile" => "Dockerfile" })n such cases, it would be helpful if #start could attempt to use Docker::Image.get(image_name) first to find a local image, and only fall back to Docker::Image.create(...) if it's not found.
Proposed logic:
begin
image = Docker::Image.get(image_name)
rescue Docker::Error::NotFoundError
image = Docker::Image.create('fromImage' => image_name)
endAlternatively — or even better — maybe the project could support building an image natively from a local Dockerfile as part of the container lifecycle setup? This would make local development more seamless and reduce external dependencies for custom containers.
Would you be open to adding this fallback behavior?
Thanks again