public class PortMapping extends Object implements Serializable, Cloneable
Port mappings allow containers to access ports on the host container instance to send or receive traffic. Port mappings are specified as part of the container definition.
Constructor and Description |
---|
PortMapping() |
Modifier and Type | Method and Description |
---|---|
PortMapping |
clone() |
boolean |
equals(Object obj) |
Integer |
getContainerPort()
The port number on the container that is bound to the user-specified
or automatically assigned host port.
|
Integer |
getHostPort()
The port number on the container instance to reserve for your
container.
|
int |
hashCode() |
void |
setContainerPort(Integer containerPort)
The port number on the container that is bound to the user-specified
or automatically assigned host port.
|
void |
setHostPort(Integer hostPort)
The port number on the container instance to reserve for your
container.
|
String |
toString()
Returns a string representation of this object; useful for testing and
debugging.
|
PortMapping |
withContainerPort(Integer containerPort)
The port number on the container that is bound to the user-specified
or automatically assigned host port.
|
PortMapping |
withHostPort(Integer hostPort)
The port number on the container instance to reserve for your
container.
|
public Integer getContainerPort()
public void setContainerPort(Integer containerPort)
containerPort
- The port number on the container that is bound to the user-specified
or automatically assigned host port. If you specify a container port
and not a host port, your container will automatically receive a host
port in the 49153 to 65535 port range.public PortMapping withContainerPort(Integer containerPort)
Returns a reference to this object so that method calls can be chained together.
containerPort
- The port number on the container that is bound to the user-specified
or automatically assigned host port. If you specify a container port
and not a host port, your container will automatically receive a host
port in the 49153 to 65535 port range.public Integer getHostPort()
hostPort
while
specifying a containerPort
and your container will
automatically receive a port in the 49153 to 65535 port range. You
should not attempt to specify a host port in the 49153 to 65535 port
range, since these are reserved for automatic assignment. The
default reserved ports are 22 for SSH, the Docker ports 2375 and 2376,
and the Amazon ECS Container Agent port 51678. Any host port that was
previously specified in a running task is also reserved while the task
is running (once a task stops, the host port is released).The current
reserved ports are displayed in the remainingResources
of
DescribeContainerInstances output, and a container instance may
have up to 50 reserved ports at a time, including the default reserved
ports (automatically assigned ports do not count toward this limit).
hostPort
while
specifying a containerPort
and your container will
automatically receive a port in the 49153 to 65535 port range. You
should not attempt to specify a host port in the 49153 to 65535 port
range, since these are reserved for automatic assignment. The
default reserved ports are 22 for SSH, the Docker ports 2375 and 2376,
and the Amazon ECS Container Agent port 51678. Any host port that was
previously specified in a running task is also reserved while the task
is running (once a task stops, the host port is released).The current
reserved ports are displayed in the remainingResources
of
DescribeContainerInstances output, and a container instance may
have up to 50 reserved ports at a time, including the default reserved
ports (automatically assigned ports do not count toward this limit).
public void setHostPort(Integer hostPort)
hostPort
while
specifying a containerPort
and your container will
automatically receive a port in the 49153 to 65535 port range. You
should not attempt to specify a host port in the 49153 to 65535 port
range, since these are reserved for automatic assignment. The
default reserved ports are 22 for SSH, the Docker ports 2375 and 2376,
and the Amazon ECS Container Agent port 51678. Any host port that was
previously specified in a running task is also reserved while the task
is running (once a task stops, the host port is released).The current
reserved ports are displayed in the remainingResources
of
DescribeContainerInstances output, and a container instance may
have up to 50 reserved ports at a time, including the default reserved
ports (automatically assigned ports do not count toward this limit).
hostPort
- The port number on the container instance to reserve for your
container. You can specify a non-reserved host port for your container
port mapping, or you can omit the hostPort
while
specifying a containerPort
and your container will
automatically receive a port in the 49153 to 65535 port range. You
should not attempt to specify a host port in the 49153 to 65535 port
range, since these are reserved for automatic assignment. The
default reserved ports are 22 for SSH, the Docker ports 2375 and 2376,
and the Amazon ECS Container Agent port 51678. Any host port that was
previously specified in a running task is also reserved while the task
is running (once a task stops, the host port is released).The current
reserved ports are displayed in the remainingResources
of
DescribeContainerInstances output, and a container instance may
have up to 50 reserved ports at a time, including the default reserved
ports (automatically assigned ports do not count toward this limit).
public PortMapping withHostPort(Integer hostPort)
hostPort
while
specifying a containerPort
and your container will
automatically receive a port in the 49153 to 65535 port range. You
should not attempt to specify a host port in the 49153 to 65535 port
range, since these are reserved for automatic assignment. The
default reserved ports are 22 for SSH, the Docker ports 2375 and 2376,
and the Amazon ECS Container Agent port 51678. Any host port that was
previously specified in a running task is also reserved while the task
is running (once a task stops, the host port is released).The current
reserved ports are displayed in the remainingResources
of
DescribeContainerInstances output, and a container instance may
have up to 50 reserved ports at a time, including the default reserved
ports (automatically assigned ports do not count toward this limit).
Returns a reference to this object so that method calls can be chained together.
hostPort
- The port number on the container instance to reserve for your
container. You can specify a non-reserved host port for your container
port mapping, or you can omit the hostPort
while
specifying a containerPort
and your container will
automatically receive a port in the 49153 to 65535 port range. You
should not attempt to specify a host port in the 49153 to 65535 port
range, since these are reserved for automatic assignment. The
default reserved ports are 22 for SSH, the Docker ports 2375 and 2376,
and the Amazon ECS Container Agent port 51678. Any host port that was
previously specified in a running task is also reserved while the task
is running (once a task stops, the host port is released).The current
reserved ports are displayed in the remainingResources
of
DescribeContainerInstances output, and a container instance may
have up to 50 reserved ports at a time, including the default reserved
ports (automatically assigned ports do not count toward this limit).
public String toString()
toString
in class Object
Object.toString()
public PortMapping clone()
Copyright © 2015. All rights reserved.