Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error output of "minikube docker-env" should go to stderr #10761

Closed
MichaelSchl opened this issue Mar 9, 2021 · 4 comments · Fixed by #10763
Closed

error output of "minikube docker-env" should go to stderr #10761

MichaelSchl opened this issue Mar 9, 2021 · 4 comments · Fixed by #10763
Labels
co/docker-env docker-env issues kind/bug Categorizes issue or PR as related to a bug.

Comments

@MichaelSchl
Copy link

Steps to reproduce the issue:
(used minikube version: 1.18.1)

  1. minikube is NOT running
  2. Execute "minikube docker-env"
  3. I get following output:
* The control plane node must be running for this command
  - To start a cluster, run: "minikube start"

which itself is fine, but the problem is the target of the output. The output seems to go to stdout, which results in a strange error if you post process the output with eval $(minikube docker-env). The leading * of the error message leads to an error like bash: <first file of current folder>: command not found referencing the first file of the current folder, which could be total unrelated to minikube.
If the output would go to stderr instead of stdout the problem would not occur. If I remember correctly, some versions ago (without knowing the exact version) this was the case, but now the output also in this error case seems to go to stdout, which raise the problem.

Full output of minikube start command used, if not already included:
As mentioned before minikube is not started.

@afbjorklund
Copy link
Collaborator

afbjorklund commented Mar 9, 2021

It happened when minikube got "smart", and tries to diagnose and fix cluster issues. This broke "docker-env" and "kubectl" both.

$ docker-machine env
Error: No machine name(s) specified and no "default" machine exists
$ docker-machine env 2>/dev/null || echo $?
1
$ minikube docker-env
🤷  Profile "minikube" not found. Run "minikube profile list" to view all profiles.
👉  To start a cluster, run: "minikube start"
$ minikube docker-env 2>/dev/null || echo $?
* Profile "minikube" not found. Run "minikube profile list" to view all profiles.
  - To start a cluster, run: "minikube start"
85

Maybe it should be a bit more dumb, and simply fail ? Because this command is normally used non-interactively, like with "eval".

# To point your shell to minikube's docker-daemon, run:
# eval $(minikube -p minikube docker-env)

@afbjorklund afbjorklund added kind/bug Categorizes issue or PR as related to a bug. co/docker-env docker-env issues labels Mar 9, 2021
@afbjorklund
Copy link
Collaborator

The same thing also applies to the "podman-env" command.

@afbjorklund
Copy link
Collaborator

afbjorklund commented Mar 9, 2021

I made the output quiet, when running under eval:

$ ./out/minikube docker-env || echo $?
🤷  Profile "minikube" not found. Run "minikube profile list" to view all profiles.
👉  To start a cluster, run: "minikube start"
85
$ eval $(./out/minikube docker-env) || echo $?
1
$ ./out/minikube docker-env | cat
false exit code 85
$ ./out/minikube docker-env || echo $?
🤷  The control plane node must be running for this command
👉  To start a cluster, run: "minikube start"
89
$ eval $(./out/minikube docker-env) || echo $?
1
$ ./out/minikube docker-env | cat
false exit code 89

Possibly there should be a more descriptive error.

@afbjorklund
Copy link
Collaborator

Note that before it would not return any error, which means that user would continue to use local docker...

A successful "docker-env" would set DOCKER_HOST, but a failing "docker-env" would just return empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/docker-env docker-env issues kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants