Skip to content

feat: use DOCKER_DEFAULT_PLATFORM env var to specify platform#800

Merged
DDtKey merged 4 commits intotestcontainers:mainfrom
trevormcdonald:docker-default-platform
Sep 15, 2025
Merged

feat: use DOCKER_DEFAULT_PLATFORM env var to specify platform#800
DDtKey merged 4 commits intotestcontainers:mainfrom
trevormcdonald:docker-default-platform

Conversation

@trevormcdonald
Copy link
Copy Markdown
Contributor

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
@netlify
Copy link
Copy Markdown

netlify bot commented Jun 26, 2025

Deploy Preview for testcontainers-rust ready!

Name Link
🔨 Latest commit 971a1aa
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-rust/deploys/68c77ab40146a8000847347e
😎 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
Copy Markdown
Contributor

DDtKey commented Jun 27, 2025

Thank you for the contribution! 🙏

@DDtKey DDtKey enabled auto-merge (squash) September 15, 2025 02:40
@DDtKey DDtKey disabled auto-merge September 15, 2025 02:56
@DDtKey DDtKey merged commit e47fb43 into testcontainers:main Sep 15, 2025
16 of 18 checks passed
@github-actions github-actions bot mentioned this pull request Oct 27, 2025
DDtKey added a commit that referenced this pull request Oct 27, 2025
## 🤖 New release

* `testcontainers`: 0.25.0 -> 0.25.1

### ⚠ `testcontainers` breaking changes

`cargo-semver-checks` suggests to release `0.26.0` as new methods added
to the public trait, which is generally breaking.
But it only affects `ImageExt` which isn't generally expected to be
implemented by users. It's already implemented for all `I: Image`

So these should be safe to ignore here


```text
--- failure trait_method_added: pub trait method added ---

Description:
A non-sealed public trait added a new method without a default implementation, which breaks downstream implementations of the trait
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-new-item-no-default
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.43.0/src/lints/trait_method_added.ron

Failed in:
  trait method testcontainers::core::ImageExt::with_hostname in file /tmp/.tmpDpXBCy/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:99
  trait method testcontainers::core::ImageExt::with_exposed_host_port in file /tmp/.tmpDpXBCy/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:125
  trait method testcontainers::core::ImageExt::with_exposed_host_ports in file /tmp/.tmpDpXBCy/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:129
  trait method testcontainers::core::ImageExt::with_device_requests in file /tmp/.tmpDpXBCy/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:248
  trait method testcontainers::ImageExt::with_hostname in file /tmp/.tmpDpXBCy/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:99
  trait method testcontainers::ImageExt::with_exposed_host_port in file /tmp/.tmpDpXBCy/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:125
  trait method testcontainers::ImageExt::with_exposed_host_ports in file /tmp/.tmpDpXBCy/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:129
  trait method testcontainers::ImageExt::with_device_requests in file /tmp/.tmpDpXBCy/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:248
```

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## [0.25.1] - 2025-10-27

### Details
#### Bug Fixes
- Replace tokio-tar with astral-tokio-tar
([#852](#852))

#### Documentation
- Rustdoc for builder API
([#820](#820))

#### Features
- Use DOCKER_DEFAULT_PLATFORM env var to specify platform
([#800](#800))
- Fallback to platform linux/amd64 when image pull fails
([#837](#837))
- Add support for devices request
([#832](#832))
- Add configurable tmpfs mount sizes
([#853](#853))
- Support `http_wait` functionallity without tls dependencies
([#850](#850))
- Add container hostname support
([#848](#848))
- Expose host ports between host and containers via ssh sidecar
([#846](#846))

#### Miscellaneous Tasks
- Update bollard-stubs requirement from =1.48.3-rc.28.0.4 to
=1.49.0-rc.28.3.3
([#828](#828))

#### Refactor
- Remove bollard_stubs dependency as bollard re-exports it
([#844](#844))

#### Testing
- Avoid flakiness in `platform` test
- Switch to testcontainers/helloworld and reduce some flakiness
([#855](#855))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Artem Medvedev <i@ddtkey.com>
DDtKey added a commit that referenced this pull request Oct 27, 2025
~~Alternative approach to #800 #837~~

I think this approach gives more flexibility API-wise. I am happy to add
tests if the maintainers think this is a more suitable approach.

Fixes #500, #718

Thanks in advance!

---------

Co-authored-by: Artem Medvedev <i@ddtkey.com>
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