portMappings property
The list of port mappings for the container. Port mappings allow containers to access ports on the host container instance to send or receive traffic.
For task definitions that use the awsvpc
network mode, you
should only specify the containerPort
. The
hostPort
can be left blank or it must be the same value as the
containerPort
.
Port mappings on Windows use the NetNAT
gateway address rather
than localhost
. There is no loopback for port mappings on
Windows, so you cannot access a container's mapped port from the host
itself.
This parameter maps to PortBindings
in the Create
a container section of the Docker Remote API and
the --publish
option to docker
run. If the network mode of a task definition is set to
none
, then you can't specify port mappings. If the network mode
of a task definition is set to host
, then host ports must
either be undefined or they must match the container port in the port
mapping.
Implementation
final List<PortMapping>? portMappings;