Docker bridge network incredibly slow

I noticed that on several AWS ec2 instances: the network (as used with rclone on aws S3) is 1000x times slower when using a bridge network.

For example, if I start a container with --network=host, the command time rclone lsd ":s3,env_auth:" takes 0.1s (same as run directly on the host).

But if I do not specify the network, or create a bridge network, the same command takes more than 2mns.

I tried to change the bridge network parameters (subnet, ip-range, gateway) with no success so far.

Any hint of what’s going on and how to fix this ?

For the record, the problem was the ec2 metadata http-put-response-hop-limit that must be increased in docker network bridge mode: e.g.

aws ec2 modify-instance-metadata-options --instance-id $ID --http-put-response-hop-limit 3  --http-endpoint enabled
1 Like