Docker for Linux: Connection Timeout

Hi,

We are trying to run docker-ce on a Ubuntu 18.04 machine(No firewall, machine has complete Internet access).
For installing Docker, we followed steps from the official documentation given here:

Initial installation works fine, but when we try to pull/run any image, it throws a connection timeout error.
This is what the error looks like:

Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

We have installed and used docker on different machines, but this is the first time that we are facing this issue.

We also created an account on docker hub and tried to logout and login using
docker logout
docker login
But this didn’t help as well.

Please help in solving this.