Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lexain12
Copy link
Contributor

@lexain12 lexain12 commented Jul 10, 2025

Also edited corresponding test.
It would be great if you could merge it into the 24 release.

Problem

After update of docker from 27.5.1 to 28.3.0, build 38b7060 error related to port parsing occured. Specifically port parsing fails on port without protocol specifier.
Maybe this issue will help clarify things.
Here is docker inspect on running scylladb/scylla:6.0 docker container, created with testcontainers api using different version of docker.

docker inspect (27.5.1 version)

"Ports": {
                "10000/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "55062"
                    }
                ],
                "22/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "55056"
                    }
                ]
}

docker inspect (28.3.0 version)

            "Ports": {
                "10000": [],
                "10000/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "55475"
                    }
                ],
                "22": [],
                "22/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "55469"
                    }
                ]
}

@netlify
Copy link

netlify bot commented Jul 10, 2025

Deploy Preview for testcontainers-rust ready!

Name Link
🔨 Latest commit c1b6f5d
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-rust/deploys/686f93139b01310008cb054e
😎 Deploy Preview https://deploy-preview-812--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.

@lexain12 lexain12 marked this pull request as ready for review July 10, 2025 10:20
Comment on lines +337 to 338
"18332": [],
"18332/tcp": [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, with this fix we will be able to parse this successfully, but only the last definition will be preserved—since Ports is effectively represented as two separate hash maps.

I'm not entirely sure what the correct behavior should be here. For example, if docker/moby reorders the entries in a future version, we could end up losing the actual HostPort value 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, this is fundamentally wrong behavior in Docker and should be fixed, because there must not be two definitions for a single port. So, I'm aiming to resolve this issue to prevent the application from crashing.

@DDtKey DDtKey merged commit ac06c5e into testcontainers:main Jul 17, 2025
12 checks passed
@github-actions github-actions bot mentioned this pull request Jul 17, 2025
@github-actions github-actions bot mentioned this pull request Jul 27, 2025
mervyn-mccreight pushed a commit that referenced this pull request Jul 27, 2025
## 🤖 New release

* `testcontainers`: 0.24.0 -> 0.25.0 (⚠ API breaking changes)

### ⚠ `testcontainers` breaking changes

```text
--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/enum_variant_added.ron

Failed in:
  variant ClientError:BuildImage in /tmp/.tmp8ymZuo/testcontainers-rs/testcontainers/src/core/client.rs:71
  variant ClientError:BuildImage in /tmp/.tmp8ymZuo/testcontainers-rs/testcontainers/src/core/client.rs:71
  variant LogSource:BothStd in /tmp/.tmp8ymZuo/testcontainers-rs/testcontainers/src/core/logs.rs:32

--- 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.41.0/src/lints/trait_method_added.ron

Failed in:
  trait method testcontainers::core::ImageExt::with_ready_conditions in file /tmp/.tmp8ymZuo/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:184
  trait method testcontainers::core::ImageExt::with_health_check in file /tmp/.tmp8ymZuo/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:206
  trait method testcontainers::ImageExt::with_ready_conditions in file /tmp/.tmp8ymZuo/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:184
  trait method testcontainers::ImageExt::with_health_check in file /tmp/.tmp8ymZuo/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:206
```

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

<blockquote>

## [0.25.0] - 2025-07-27

### Details
#### Bug Fixes
- Make tls features optional
([#806](#806))
- Add `Send` trait to `stderr` & `stdout` of `ExecResult`
([#809](#809))
- Added new parse rule for correctly parsing ports without protocol
specifier
([#812](#812))

#### Features
- Allow ready conditions customization via ImageExt
([#794](#794))
- Allow to wait for log line on either stdout or stderr
([#795](#795))
- Add `Container*::exit_code`
([#791](#791))
- Add `Container*::is_running`
([#790](#790))
- Add custom health check support for containers
([#816](#816))
- Introduce container builder api
([#801](#801))

#### Miscellaneous Tasks
- [❗] Update bollard to 1.19.1
([#817](#817))

#### Refactor
- Testimages and tests to use builder API
([#804](#804))
</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>
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.

2 participants