Docker: failed to pull image (oversized record received with length 20527

6/21/2017

I have a problem trying to use Kubernetes (a container management platform) to pull docker images from my local registry.

The current situation is that I have docker images stored in my docker VM, which is running on address: 192.168.99.103. I am running docker from a Windows machine.

I have an image which i created locally called 'tomcat-test:dockerfile'.

I next create and run a local registry using the following command:

docker run -d -p 5000:5000 --restart always --name registry registry:2

At this point, I tag the image like so:

docker tag tomcat-test:dockerfile localhost:5000/tomcat-test:latest

And finally, I push to the local registry using the following command:

docker push localhost:5000/tomcat-test:latest

This is succcesfully pushed to the registry.

Now I want to use Kubernetes to pull from my local docker registry. To do this, I have to provide the URL of where the image is located in the docker registry:

I assume the URL is:

192.168.99.103:5000/tomcat-test:latest

However, I get the following error:

Failed to pull image "192.168.99.103:5000/tomcat-test": rpc error: code = 2 desc = Error response from daemon: Get https://192.168.99.103:5000/v1/_ping: tls: oversized record received with length 20527

I suspect that this is an error message from Docker.

Now I have researched online, and there have been suggestions to create a new docker machine, where you specify the IP of an insecure registry. Therefore I have used the following command:

docker-machine create -d virtualbox --engine-insecure-registry localhost:5000 dev2

However after following the steps above, this still did not work and I have got the same error.

Has anyone come across a solution to this issue? And also is there anything that I should be doing different to prevent this issue from appearing?

Any help would be appreciated.

Thanks.

-- rm12345
boot2docker
docker
docker-machine
kubernetes

1 Answer

6/28/2017

Found a workaround to this:

If you are using minikube, you can use the 'ssh' command to go into the minikube VM:

minikube ssh

This will bring up the shell. Here you can pull docker images from docker hub by entering command:

docker pull <repo_name>

By doing this, you'll then pull the image into the minikube VM.

Following this, the next step is to exit the minikube ssh shell and run the following command on the command line:

kubectl.exe run <YOUR_POD_NAME> --image=<docker_repo_name>

where kubectl.exe is the kubernetes executable and is the name of the repository that you want to pull the latest image from

for example:

kubectl.exe run ubuntu-test-3 --image=rm12345/ubuntutest3:latest

This should run successfully.

Note that in order for a pod to run successfully in kubernetes, you must ensure that your Docker container has an entry point which will run the application indefinitely. if it does not, then you may see a 'CrashBackLoop' status on the pod, rather than the 'running' status.

-- rm12345
Source: StackOverflow