Using 'docker_* tasks' conflicts with minikube environment from chapter 2.
gimballock opened this issue Β· comments
If using the same shell env from chapter 2 where we ran:
$ minikube docker-env
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://127.0.0.1:55002"
export DOCKER_CERT_PATH="/Users/eprice/.minikube/certs"
export MINIKUBE_ACTIVE_DOCKERD="minikube"
# To point your shell to minikube's docker-daemon, run:
# eval $(minikube -p minikube docker-env)
$ eval $(minikube docker-env)
Then I get errors with 'docker_image' and 'docker_container' like this:
TASK [Ensure Docker registry image is present.] *************************************************
fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "Error connecting: Error while fetching server API version: HTTPSConnectionPool(host='127.0.0.1', port=55002): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x10bf36970>: Failed to establish a new connection: [Errno 61] Connection refused'))"}
To get around this I have to either use a new shell or run the following:
$ minikube docker-env -u
unset DOCKER_TLS_VERIFY;
unset DOCKER_HOST;
unset DOCKER_CERT_PATH;
unset MINIKUBE_ACTIVE_DOCKERD;
$ eval $(minikube docker-env -u)
After downgrading kubernetes and openshift python packages and restarting minikube I still see the same issue.
$ pip3 list
Package Version
------------------- ---------
-ubernetes 11.0.0
...
docker-py 1.10.6
docker-pycreds 0.4.0
...
kubernetes 11.0.0
...
openshift 0.11.2
...
$ minikube stop
$ minikube start
π minikube v1.17.1 on Darwin 11.2.1
β¨ Using the docker driver based on existing profile
π Starting control plane node minikube in cluster minikube
π Restarting existing docker container for "minikube" ...
π³ Preparing Kubernetes v1.20.2 on Docker 20.10.2 ...
π Verifying Kubernetes components...
π Enabled addons: storage-provisioner, default-storageclass
β /usr/local/bin/kubectl is version 1.18.6, which may have incompatibilites with Kubernetes 1.20.2.
βͺ Want kubectl v1.20.2? Try 'minikube kubectl -- get pods -A'
π Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
$ ansible-playbook -i inventory main.yml
...
TASK [Create and start the build container.]
...
"msg": "Error connecting: Error while fetching server API version: HTTPSConnectionPool(host='127.0.0.1', port=55002): Max retries exceeded with url: /version (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:1123)')))"
Sorry, I should have read the error more. What version of python are you using?
Sorry for the delay, Python 3.9.2
I think what's happening is that you have the incorrect python compatibility with docker, or at least that is a part of it
Given this ticket, which I'm surprised you didn't get this error
Uninstall docker-py, and run pip3 install docker