public static class Ports.Binding extends Object
Ports.Binding
represents a socket on the Docker host that is used in a PortBinding
. It is
characterized by an IP address
and a port number
. Both properties may
be null
in order to let Docker assign them dynamically/using defaults.Ports.bind(ExposedPort, Binding)
,
ExposedPort
Constructor and Description |
---|
Ports.Binding()
|
Ports.Binding(Integer hostPort)
|
Ports.Binding(String hostIp)
|
Ports.Binding(String hostIp,
Integer hostPort)
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getHostIp() |
Integer |
getHostPort() |
static Ports.Binding |
parse(String serialized)
Parses a textual host and port specification (as used by the Docker CLI) to a
Ports.Binding . |
String |
toString()
Returns a string representation of this
Ports.Binding suitable for inclusion in a JSON message. |
public Ports.Binding(String hostIp, Integer hostPort)
Ports.bind(ExposedPort, Binding)
,
ExposedPort
public Ports.Binding(Integer hostPort)
Ports.bind(ExposedPort, Binding)
,
ExposedPort
public Ports.Binding(String hostIp)
public Ports.Binding()
public String getHostIp()
null
, in which case Docker will bind the port
to all interfaces (0.0.0.0
).public Integer getHostPort()
null
, in which case Docker will dynamically
assign a port.public static Ports.Binding parse(String serialized) throws IllegalArgumentException
Ports.Binding
.
Legal syntax: IP|IP:port|port
serialized
- serialized the specification, e.g. 127.0.0.1:80
Ports.Binding
matching the specificationIllegalArgumentException
- if the specification cannot be parsedpublic String toString()
Ports.Binding
suitable for inclusion in a JSON message. The format
is [IP:]Port
, like the argument in parse(String)
.toString
in class Object
Ports.Binding
Copyright © 2015. All Rights Reserved.