Download mirror error Couldn't connect: SOCKS protocol error in minikube

Keywords: Docker ssh JSON sudo

Problem description

The agent environment variable used to start minikube creates a minikube virtual machine, but errors occur when downloading or querying mirrors, such as the following two commands reporting a similar error: "Couldn't connect: SOCKS protocol error"

# Execute outside the minikube virtual machine
$ kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.4 --port=8080

$ minikube ssh 
# Execution in minikube virtual machine
$ docker search echoserver
Error response from daemon: Get https://index.docker.io/v1/search?q=echoserver&n=25: Couldn't connect: SOCKS protocol error

Problem reason

Go into the minikube virtual machine and use docker info to see the configuration of docker

$ minikube ssh 

$ docker info
Containers: 21
 Running: 21
 Paused: 0
 Stopped: 0
Images: 10
Server Version: 18.09.8
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 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: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: N/A
init version: N/A (expected: )
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.15.0
Operating System: Buildroot 2018.05.3
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.897GiB
Name: minikube
ID: I7FY:LMTY:F4SU:NTMU:IJ7Q:FTIB:3UWP:TKLG:42XA:QQOX:JAFD:PV2B
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
HTTP Proxy: http://<host>:<port>
HTTPS Proxy: http://<host>:<port>
No Proxy: 127.0.0.1/24
Registry: https://index.docker.io/v1/
Labels:
 provider=virtualbox
Experimental: false
Insecure Registries:
 10.96.0.0/12
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

It contains the following three lines, which are the agents you used when you started minikube, which were written into the docker configuration file by minikube.

HTTP Proxy: http://<host>:<port>
HTTPS Proxy: http://<host>:<port>
No Proxy: 127.0.0.1/24

Solution

Log in to the virtual machine using the "minikube ssh" command, and then modify the Docker configuration file / usr / lib / system / system / docker. service, which is the path of the Docker configuration file on CentOS 7. x, commenting out the three lines above.

#Environment=HTTP_PROXY=http://192.168.0.53:1080
#Environment=HTTPS_PROXY=http://192.168.0.53:1080
#Environment=NO_PROXY=127.0.0.1/24

Restart service

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker.service

Then re-query or retrieve the mirror to solve the problem.

Posted by MadDogSh on Thu, 03 Oct 2019 03:08:55 -0700