docker image build command fails with “(Client.Timeout exceeded while awaiting headers)”

I am new to docker and Ubuntu 16.04 OS as well. My configuration is as follows:



$ lsb_release -a

No LSB modules are available.

Distributor ID: Ubuntu

Description: Ubuntu 16.04.5 LTS

Release: 16.04

Codename: xenial

========================== Docker:


$ docker info

Containers: 2

Running: 0

Paused: 0

Stopped: 2

Images: 5

Server Version: 18.09.0

Storage Driver: overlay2

Backing Filesystem: extfs

Supports d_type: true

Native Overlay Diff: true

Logging Driver: json-file

Cgroup Driver: cgroupfs


Volume: local

Network: bridge host macvlan null overlay

Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog

Swarm: inactive

Runtimes: runc

Default Runtime: runc

Init Binary: docker-init

containerd version: c4446665cb9c30056f4998ed953e6d4ff22c7c39

runc version: 4fc53a81fb7c994640722ac585fa9ca548971871

init version: fec3683

Security Options:



Profile: default

Kernel Version: 4.15.0-42-generic

Operating System: Ubuntu 16.04.5 LTS

OSType: linux

Architecture: x86_64

CPUs: 4

Total Memory: 15.4GiB

Name: smarthi-ORADEV


Docker Root Dir: /var/lib/docker

Debug Mode (client): false

Debug Mode (server): false

Username: bluesangig



Experimental: false

Insecure Registries:

Live Restore Enabled: false

Product License: Community Engine

WARNING: No swap limit support


I am connect to office VPN network and all my accesses to office and internet are working fine with my Network proxy configuration done in my laptop.

Even “docker container run” commands are also working fine.

But when I try to do “docker image build” using a docker file whose content is: FROM busybox RUN echo “building simple docker image” CMD [echo, “hello container”]

I am getting below error message: $ docker image build -t testimg . Sending build context to Docker daemon 2.048kB Step 1/3 : FROM busybox Get net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

I had searched a bit and found that we may need to set the proxy in the ~/.docker/config.json file, and I had added the proxy entries as mentioned in the issue#

Even after adding the entries as suggested in the above issue, I still face the same issue.

I am little clueless now on how to solve this issue with docker image build. Any help would be greatly appreciated.