Skip to content

no way to map container port to different host port #256

@Bill

Description

@Bill

docker -p 8003:5432 will expose container port 5432 on host port 8003.

This is extremely valuable when running parallel tests. It lets us avoid port conflicts.

I see no straightforward way to accomplish this with testcontainers.

Container.withExposedPorts(Integer... ports) takes a port array and maps each container port in the array, to the corresponding port on the host.

I expected to find a method with this signature something like this:

Container.withExposedPorts(Map<Integer,Integer> mappings)

Or maybe even:

Container.withExposedPortMappings(Integer... mappings)

…that would take the flattened mapping.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions