Skip to content

[Bug]: UDP port exposing+mapping #930

@Hr0bar

Description

@Hr0bar

Testcontainers version

0.18.0

Using the latest Testcontainers version?

Yes

Host OS

Ubuntu 22.04.2

Host arch

x86

Go version

1.18.1

Docker version

Client:
version: 20.10.12
API: 1.41
Go version: go.1.17.3
Server
version: 20.10.12
API: 1.41

Docker info

Server:
Containers: 1
Stopped: 1

What happened?

When doing simple:

ExposedPorts: []string{"1812/udp"},

The container fails to start with:
"port lookup failed: failed to find "1812": port not found.
Is UDP supported? It seems the code does some splitting to get tcp/udp from the port name, but is it propagated all the way down? It seems to break somewhere on port mapping to host.

When we do:
ExposedPorts: []string{"1812/udp","1812/tcp"},
The container starts with:

mapped container port "1812" to host port "49263"
mapped container port "1812" to host port "49263"

So it seems it simply reuses the TCP mapping (which would be fine, if UDP was brought up on the same port, but nothing is listening there on UDP and all connections to UDP fail)

The only example of using UDP I found here:
https://github.com/testcontainers/testcontainers-go/blob/566911ed03ec6b46bf12173f35e57f374074ba0c/examples/consul/consul.go

but thats with TCP as well.

Relevant log output

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue with the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions