public class ExposedPort extends Object implements Serializable
port number and an
InternetProtocol. It can be published by Docker by binding it to a host port,
represented by a Ports.Binding.| Constructor and Description |
|---|
ExposedPort(int port)
|
ExposedPort(int port,
InternetProtocol protocol)
Creates an
ExposedPort for the given parameters. |
ExposedPort(String scheme,
int port)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getPort() |
InternetProtocol |
getProtocol() |
String |
getScheme()
Deprecated.
use
getProtocol() |
static ExposedPort |
parse(String serialized)
Parses a textual port specification (as used by the Docker CLI) to an
ExposedPort. |
static ExposedPort |
sctp(int port)
Creates an
ExposedPort for InternetProtocol.SCTP. |
static ExposedPort |
tcp(int port)
Creates an
ExposedPort for InternetProtocol.TCP. |
String |
toString()
Returns a string representation of this
ExposedPort suitable for inclusion in a JSON message. |
static ExposedPort |
udp(int port)
Creates an
ExposedPort for InternetProtocol.UDP. |
public ExposedPort(int port,
InternetProtocol protocol)
ExposedPort for the given parameters.port - the port numberprotocol - the InternetProtocolpublic ExposedPort(int port)
port - the port number@Deprecated public ExposedPort(String scheme, int port)
ExposedPort(int, InternetProtocol)ExposedPort for the given parameters.scheme - the scheme, tcp, udp or sctpport - the port numberpublic InternetProtocol getProtocol()
InternetProtocol of the port that the container exposes@Deprecated public String getScheme()
getProtocol()tcp, udp or sctppublic int getPort()
public static ExposedPort tcp(int port)
ExposedPort for InternetProtocol.TCP. This is a shortcut for
new ExposedPort(port, InternetProtocol.TCP)public static ExposedPort udp(int port)
ExposedPort for InternetProtocol.UDP. This is a shortcut for
new ExposedPort(port, InternetProtocol.UDP)public static ExposedPort sctp(int port)
ExposedPort for InternetProtocol.SCTP. This is a shortcut for
new ExposedPort(port, InternetProtocol.SCTP)public static ExposedPort parse(String serialized) throws IllegalArgumentException
ExposedPort.serialized - the specification, e.g. 80/tcpExposedPort matching the specificationIllegalArgumentException - if the specification cannot be parsedpublic String toString()
ExposedPort suitable for inclusion in a JSON message. The format is
port/protocol, like the argument in parse(String).toString in class ObjectExposedPortCopyright © 2025. All rights reserved.