docker networking – host mode vs bridge mode – port mapping

In production, host mode networking is recommended over bridge mode to avoid packet forwarding overhead.

$ docker container run --help | grep "network"
      --network network                Connect a container to a network
      --network-alias list             Add network-scoped alias for the container

Cloudformation resource type AWS::ECS::TaskDefinition option(NetworkMode) internally use decides the network mode to launch docker containers, where it says:

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.


Using AWS::ECS::TaskDefinition,

Am launching single instance of master jenkins(docker container) with port mapping of 8080:8080. EC2 port 8080 mapping with container port 8080.


What does it mean to say? cannot run multiple instantiations of the same task on a single container instance when port mappings are used….

Source: StackOverflow

LEAVE A COMMENT