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 ec2-52-203-80-184.compute-1.amazonaws.com:5000 --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 docker.io/library/hello-world Error while pulling image: Get https://index.docker.io/v1/repositories/library/hello-world/images: dial tcp 188.8.131.52:443: getsockopt: connection refused
The insecure registry is configured as DOCKER_OPTS in both /etc/default/docker
ExecStart=/usr/bin/dockerd $DOCKER_OPTS -H fd://
It seems from the error, it is still trying to grab image from index.docker.io/ 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 ec2-52-203-80-184.compute-1.amazonaws.com:5000/hello-world
Using default tag: latest
Error response from daemon: Get https://ec2-52-203-80-184.compute-1.amazonaws.com:5000/v1/_ping: dial tcp 184.108.40.206:5000: 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.