-
Notifications
You must be signed in to change notification settings - Fork 160
feat: use DOCKER_DEFAULT_PLATFORM env var to specify platform #800
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
base: main
Are you sure you want to change the base?
feat: use DOCKER_DEFAULT_PLATFORM env var to specify platform #800
Conversation
When the env var is set the platform is passed for both image and container creation in parity with the docker CLI. This is especially useful on apple silicon when developing for linux environments. fixes testcontainers#500, testcontainers#718
✅ Deploy Preview for testcontainers-rust ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Thank you for the contribution! 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main issue I see is that testcontsiners can utilize remote docker (or testcontsiners cloud)
So relying on DOCKER_DEFAULT_PLATFORM
might not be appropriate way, because your local setup might differ from the one used with testcontsiners.
In that case, there should be a way to override the variable only for testcontsiners at least
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker host can be currently overridden by properties file, so I guess it can be solved similarly.
However, the format of properties must be aligned with implementations in other languages 🤔
Let me think a little bit, perhaps we should accept the PR and allow overriding as follow-up
Because another important fact is that testcontainers respect DOCKER_HOST
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the effort! I looked around a bit at the state of other language implementations and noticed the java version will fall back to a specific platform if an initial pull fails: https://github.com/testcontainers/testcontainers-java/blob/b2b404a9a87ed70d0672fe5bb9ac1e3a463af94f/core/src/main/java/org/testcontainers/images/RemoteDockerImage.java#L165
That may work for at least my specific case, will test it soon if that is a desired alternative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense in general
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trevormcdonald Just following up to see if you’ve had any success with your suggestion above?
When the env var is set the platform is passed for both image and container creation in parity with the docker CLI.
This is especially useful on apple silicon when developing for linux environments.
fixes #500, #718