2

I want to work on openshift projects from wsl. I have set up Minishift and VirtualBox on Windows, and have, as far as I can tell, aliased everything appropriately like so.

alias minishift='/mnt/c/Users/<username>/minishift-#####/minishift.exe'
#Sets oc binary alias
alias oc="$(wslpath -a $(minishift oc-env | grep -oP "(?<=PATH=)[^;]+"))/oc.exe"
#Sets docker environment variables
for i in $(minishift docker-env | awk '/SET/{print $2}');do if $( echo ${i} | grep -q 'DOCKER_CERT_PATH' );then eval DOCKER_CERT_PATH=$(wslpath -a $(echo ${i} | grep -oP "C:.*$"));else eval ${i};fi;done

However, I can't reach the local docker registry from wsl.

$ oc whoami -t | docker login -u developer --password-stdin $(minishift openshift registry)
INFO[0015] Error logging in to v2 endpoint, trying next endpoint: Get https://172.30.1.1:5000/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
INFO[0036] Error logging in to v1 endpoint, trying next endpoint: Get https://172.30.1.1:5000/v1/users/: dial tcp 172.30.1.1:5000: connect: connection refused
Get https://172.30.1.1:5000/v1/users/: dial tcp 172.30.1.1:5000: connect: connection refused

I'm not an expert on Docker, but what was confusing to me is that this IP was different than the DOCKER_HOST. It works fine from Windows.

C:\Users\${username}>oc whoami -t | docker login -u developer --password-stdin 172.30.1.1:5000
Login Succeeded

Perhaps the docker registry is set up on the Host Only Adapter on virtualbox and maybe wsl can't communicate with it for that reason?

Any insight or advice on my intended setup is greatly welcome.

1
  • I'm not actually running Docker in WSL. I'm running the client from WSL attempting to connect to the minishift docker registry running with virtualbox. I actually figured this out. I was not 'exporting' the variables in WSL. I've posted the change and answer to my question below.
    – David F
    Commented Aug 30, 2019 at 20:56

1 Answer 1

0

I realized that I was not actually exporting the variables I was setting in WSL. Derp.

Changing the one-liner I had to the following allows me to log in using the wsl docker client

for i in $(minishift docker-env | awk '/SET/{print $2}');do if $( echo ${i} | grep -q 'DOCKER_CERT_PATH' );then eval export DOCKER_CERT_PATH=$(wslpath -a $(echo ${i} | grep -oP "C:.*$"));else eval export ${i};fi;done



$ oc whoami -t | docker login -u developer --password-stdin $(minishift openshift registry)
Login Succeeded

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .