Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

trevormcdonald
Copy link

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

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
Copy link

netlify bot commented Jun 26, 2025

Deploy Preview for testcontainers-rust ready!

Name Link
🔨 Latest commit 4c6e0e8
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-rust/deploys/685ccb31f1db8300083241e9
😎 Deploy Preview https://deploy-preview-800--testcontainers-rust.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@trevormcdonald trevormcdonald marked this pull request as ready for review June 26, 2025 04:27
@DDtKey
Copy link
Collaborator

DDtKey commented Jun 27, 2025

Thank you for the contribution! 🙏

Copy link
Collaborator

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

Copy link
Collaborator

@DDtKey DDtKey Jun 27, 2025

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

Copy link
Author

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.

Copy link
Collaborator

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

Copy link
Collaborator

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?

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

Successfully merging this pull request may close these issues.

is there any way to pass "platform" parameter when running docker images?
3 participants