The Docker networking mode to use for the containers in the task. The valid values are none
, bridge
, awsvpc
, and host
. The default Docker network mode is bridge
. If you are using the Fargate launch type, the awsvpc
network mode is required. If you are using the EC2 launch type, any network mode can be used. If the network mode is set to none
, you cannot specify port mappings in your container definitions, and the tasks containers do not have external connectivity. The host
and awsvpc
network modes offer the highest networking performance for containers because they use the EC2 network stack instead of the virtualized network stack provided by the bridge
mode.
With the host
and awsvpc
network modes, exposed container ports are mapped directly to the corresponding host port (for the host
network mode) or the attached elastic network interface port (for the awsvpc
network mode), so you cannot take advantage of dynamic host port mappings.
If the network mode is awsvpc
, the task is allocated an elastic network interface, and you must specify a NetworkConfiguration value when you create a service or run a task with the task definition. For more information, see Task Networking in the Amazon Elastic Container Service Developer Guide .
Note
Currently, only Amazon ECS-optimized AMIs, other Amazon Linux variants with the ecs-init
package, or AWS Fargate infrastructure support the awsvpc
network mode.
If the network mode is host
, you cannot run multiple instantiations of the same task on a single container instance when port mappings are used.
Docker for Windows uses different network modes than Docker for Linux. When you register a task definition with Windows containers, you must not specify a network mode. If you use the console to register a task definition with Windows containers, you must choose the <default>
network mode object.
For more information, see Network settings in the Docker run reference .
ncG1vNJzZmiZp6iwrbWNmqSasp%2Bjrri%2FjZympmemZ3ylu8KupJ6mpJbBqrvNaJipoV9ne3F6km1mq52Wmr%2BmusKeZp6bo2Sxpr%2FCq6CbnV2prrS3jJ2cn6GensGqu81nn62lnA%3D%3D