Docker Community Forums

Share and learn in the Docker community.

Can't connect to docker registries on Ubuntu VM

I installed docker-toolbox on my windows PC. Used the following command to create a docker-machine that connects to insecure registry on AWS

docker-machine create -d virtualbox --engine-insecure-registry --engine-env HTTP_PROXY=https://<username>:<password>@<proxy-url>:80 default

Since we are behind company proxy, I had to specify http_proxy in the command. It works just fine. And I was able to pull images like hello-world from that registry.

However I am more comfortable with Linux, so I tried to install docker on Ubuntu VM (16.04) on VirtualBox following the docker doc for ubuntu. The install is successful. I started docker with sudo systemctl start docker. When I try to pull docker image though, I got the following error:

$ sudo docker pull hello-world
Using default tag: latest
Pulling repository
Error while pulling image: Get dial tcp getsockopt: connection refused

The insecure registry is configured as DOCKER_OPTS in both /etc/default/docker


and /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd $DOCKER_OPTS -H fd://

It seems from the error, it is still trying to grab image from instead of the specified aws site.

I even tried to specify the registry in docker pull command and still got “connection refused” error.
$ sudo docker pull
Using default tag: latest
Error response from daemon: Get dial tcp getsockopt: connection refused

Why am I getting this connection error? http_proxy and https_proxy are set manually in the Network Settings of the VM without which I could not connect to the internet.