minikube docker-env suggested command on Windows 10 in cmd window does not work

Created on 20 Dec 2017  路  5Comments  路  Source: kubernetes/minikube

Is this a BUG REPORT or FEATURE REQUEST? (choose one):
BUG REPORT

Please provide the following details:

Environment:
Windows 10
cmd.exe running as administrator

Minikube version (use minikube version):
minikube version: v0.24.1

  • OS (e.g. from /etc/os-release):
    Windows 10
  • VM Driver (e.g. cat ~/.minikube/machines/minikube/config.json | grep DriverName):
    hyperv
  • ISO version (e.g. cat ~/.minikube/machines/minikube/config.json | grep -i ISO or minikube ssh cat /etc/VERSION):
    v0.23.6
  • Install tools:
  • Others:

What happened:
When I do the following in cmd.exe running as administrator on Windows 10 with minikube installed and running.

> minikube docker-env
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.1.20:2376
SET DOCKER_CERT_PATH=C:\Users\schitale\.minikube\certs
SET DOCKER_API_VERSION=1.23
REM Run this command to configure your shell:
REM @FOR /f "tokens=*" %i IN ('minikube docker-env') DO @%i

Then as it says I do:

> @FOR /f "tokens=*" %i IN ('minikube docker-env') DO @%i

Then I do:

> docker ps
Get http://192.168.1.20:2376/v1.23/containers/json: malformed HTTP response "\x15\x03\x01\x00\x02\x02".
* Are you trying to connect to a TLS-enabled daemon without TLS?

What you expected to happen:

I should get a good output from docker ps.

How to reproduce it (as minimally and precisely as possible):
See above. It appears that docker ended up using http instead of https. The reason is that DOCKER_TLS_VERIFY is not getting set. Argh.

Check by doing:

> set | findstr /L DOCKER
DOCKER_API_VERSION=1.23
DOCKER_CERT_PATH=C:\Users\\.minikube\certs
DOCKER_HOST=tcp://192.168.1.20:2376

Output of minikube logs (if applicable):
N/A
Anything else do we need to know:

The problem seems to be that DOCKER_TLS_VERIFY is not getting set.

So I did the following to echo what is being set. You cannot see it in this snippet as the markup editor removes it but the place where XXXXXXXX is, where the BOM char appears.

> @FOR /f "tokens=*" %i IN ('minikube docker-env') DO echo @%i

c:\Users\schitale
> echo @XXXXXXXXSET DOCKER_TLS_VERIFY=1
@SET DOCKER_TLS_VERIFY=1
:
:

See:
image

This can be worked around by just emitting a blank line as first line in the output of the minikube docker-env command. There is even some kind of skip syntax skip=1`` or something like that of theFOR`` command to ignore first line.

kinbug lifecyclrotten owindows

Most helpful comment

A workaround for anyone is stumped on this is to paste this command, and type CTRL+L after the delims=

@FOR /f "tokens=* delims=" %i IN ('minikube docker-env') DO %i

The command will look like this:

@FOR /f "tokens=* delims=^L" %i IN ('minikube docker-env') DO %i

And then execute it. Now docker ps should work.

All 5 comments

I think the fix should be here:

https://github.com/kubernetes/minikube/blob/55fb9393d063a3fe8c4fc108fb172778f75a4707/cmd/minikube/cmd/env.go#L41

Add a n to the beginning of the template.

A workaround for anyone is stumped on this is to paste this command, and type CTRL+L after the delims=

@FOR /f "tokens=* delims=" %i IN ('minikube docker-env') DO %i

The command will look like this:

@FOR /f "tokens=* delims=^L" %i IN ('minikube docker-env') DO %i

And then execute it. Now docker ps should work.

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Was this page helpful?
0 / 5 - 0 ratings