Skip to content

Enhance port handling in Address and Ports classes.#20

Merged
gustavofreze merged 1 commit intomainfrom
feature/develop
Apr 14, 2026
Merged

Enhance port handling in Address and Ports classes.#20
gustavofreze merged 1 commit intomainfrom
feature/develop

Conversation

@gustavofreze
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 14, 2026 01:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the container address port model to distinguish between container-internal exposed ports and host-mapped ports by reading NetworkSettings.Ports from docker inspect, surfacing host ports via the Ports contract, and documenting/testing the new behavior.

Changes:

  • Parse host port bindings from docker inspect (NetworkSettings.Ports) and store them alongside exposed ports.
  • Extend the Ports contract + implementation with hostPorts() and firstHostPort().
  • Add unit tests and README examples covering host port mappings, multiple mappings, and null bindings.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/Unit/Mocks/InspectResponseFixture.php Adds NetworkSettings.Ports to fixtures so tests can simulate host port bindings.
tests/Unit/GenericDockerContainerTest.php Adds unit coverage for host port parsing and new Ports API.
src/Internal/Containers/ContainerInspection.php Extracts host-mapped ports from inspect payload and wires them into Address.
src/Internal/Containers/Address/Ports.php Stores exposed vs host-mapped ports separately and exposes new accessors.
src/Contracts/Ports.php Public contract update to include host port access methods.
README.md Documents how to access container vs host ports after start.

@gustavofreze gustavofreze merged commit 9512f5c into main Apr 14, 2026
10 checks passed
@gustavofreze gustavofreze deleted the feature/develop branch April 14, 2026 01:41
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