Git clone command fails with timeout

I am attempting to run a docker container for a ROS application on a Horizon cloud server. The Dockerfile contains some installation commands followed by a git clone command that always times out on this command. I have whittled the file down for simplicity. The start of the command file sim.Dockerfile is as follows:

FROM ros:melodic-robot-bionic
RUN apt-get update --fix-missing && apt-get install -y python-pip
RUN apt-get install -y libzmq3-dev git build-essential autoconf libtool cmake vim
RUN git clone https://github.com/protocolbuffers/protobuf.git

The command I run to execute is:

docker build -t "sim:sim.Dockerfile" .

The error I get is:

Step 4/16 : RUN git clone https://github.com/protocolbuffers/protobuf.git
 ---> Running in fb39c1b92402
Cloning into 'protobuf'...
fatal: unable to access 'https://github.com/protocolbuffers/protobuf.git/': Operation timed out after 300032 milliseconds with 0 out of 0 bytes received
ERROR: Service 'sim' failed to build : The command '/bin/sh -c git clone https://github.com/protocolbuffers/protobuf.git' returned a non-zero code: 128

However, if I run those same commands (minuis the leading RUN command), the git clone immediately downloads the repo from github as expected.

What is possibly preventing it from running inside docker? Is there some networking configuration I need to do to resolve this? Thanks.

Found out this was due to a mismatch of the MTU value. The cloud server uses an MTU value of 1400, so docker needs to be less than or equal to that. The dafault value for docker is 1500, hence it fails.

This can be corrected by creating a file /etc/docker/daemon.json with contents:

{
  "mtu": 1400
}

or changing the /etc/default/docker file to include the line:

DOCKER_OPTS="--mtu=1400"

or if you are using docker-compose, by adding the following to your YML file:

networks:
  default:
    driver: bridge
    driver_opts:
      com.docker.network.driver.mtu: 1400

This seems to have corrected the issue for me.