minikube: Minikube v1.30.1 unable to resolve current docker CLI context after upgrade on Ubuntu 22.04 LTS
What Happened?
I searched for an official minikube upgrade guide on the site, and didn’t find one. So I upgraded in the default manner for how I installed it, which was via dpkg -i <new_minikube_deb> on Ubuntu, as described here: https://minikube.sigs.k8s.io/docs/start/, after stopping minikube.
This worked fine, and I can start my existing profiles (clusters), but every minikube command prints this to stderr:
W0628 13:39:29.689502 3873862 main.go:291] Unable to resolve the current Docker CLI context "default": context "default" does not exist
My current docker context is:
docker context show
# output
default
I tried systemctl restart docker.service and systemctl restart docker.socket, both of which didn’t resolve this.
I’m actually not even sure what this error means in practical terms. It happens for all minikube commands, across profiles.
Attach the log file
Operating System
Ubuntu
Driver
Docker
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 1
- Comments: 28 (2 by maintainers)
@life5ign Try using
docker context use defaultto update your active context which Minikube will pick up.Well that fixed it. I guess I never tried because
docker context showprinteddefault.Thanks!
This command helped fixed this issue on my end. I was getting the error when I run “
minikube ssh” on my Windows machine: Error:W0810 07:22:32.053865 12548 main.go:291] Unable to resolve the current Docker CLI context "default": context "default": context not found: open C:\I’ve had this issue as well - but default wasn’t the answer for me. instead of “docker context show” (which shows default which is what minikube is trying to use), i did “docker context ls” which shows all contexts of docker env. for some reason my local docker engine context was named “desktop-linux”. “docker context use desktop-linux” solved it… hope this helps.
I got the same error when I run
minikube ipand executedocker context use defaultmake it worked for meIt worked well for me
So, as it turns out, it’s actually not a bug upstream in Docker, but rather a “known limitation”. There should be guards in place, but it looks like that’s not the case. There is, however, support for resolving the default context, using the
ContextStoreWithDefault, but that requires to pull in some additional packages, and I don’t know if the Minikube project wants to do that.Taking a step back, I was questioning the purpose of this code, in general, as I think that that determines if you want to go into this direction. Some questions that popped up with me:
DOCKER_HOSTenv var. Why is that needed?defaultcontext, then Minikube is still capable of doing its job, how is that possible?I don’t really know who to tag for this, as I’m not familiar with the Minikube project. @mzuzek Do you know perhaps?
I’ve updated the gist with my hack attempt to make use of this
ContextStoreWithDefault. That’s working, and I can succesfully retrieve thedefaultcontext. Just in case, someone wants to know what it takes to use this other API.Thank you @tiesmaster for picking this up! Keeping my fingers crossed for the Docker ticket.
AFAICT, this is still an issue, and fully agree that this is a problem upstream in Docker. I’ve managed to make a reproduction, as shown below. @mzuzek Thanks for the hints, that definitely helped! I intent to open a ticket upstream, if anyone hasn’t already. If I don’t hear anything within, like a day, I will open the ticket.
Reproduction (full reproduction code, including the
go.mod):Find out appropriate settings:
Then check certs
Finally create special docker context
And then use it:
Hi,
I got the same issue on Windows, below there is my current version of minikube and windows
minikube v1.31.2 on Microsoft Windows 11 Pro 10.0.22621.2134 Build 22621.2134In attachment, there is the screenshot of the output from
docker context ls. Why should I usedocker context use defaultif it is already adopted?I guess the warning message can be safely demoted to a debug message
thanks a lot timothytavarez.
docker context use default worked for me !
minikube v1.31.2 on Ubuntu 22.04 x86-64 Client: Docker Engine - Community Version: 24.0.5 Server: Docker Engine - Community Engine: Version: 24.0.5 API version: 1.43 (minimum version 1.12) Go version: go1.20.6
This issue is so weird, docker context shows that default context is in use (marked with asterisk), but the warning message shows a file not found , and that file’s path belongs to the other context which is not in use (desktop-linux context).
Looks like running - docker context use default - command refreshed that path to the right one.
Thanks everyone for your help
Minikube 1.31.1 CLI commands like
minikube ipon Windows 11 Pro 10.0.22621.1702 with Docker Desktop 4.22.1 (details: docker_version.txt) on WSL2-based backend gave me the warning (@@@is my user name; line breaks added for clarity):Weirdly enough, in VS Code the terminal (PS again) doesn’t show the path, as in the issue description:
On my side
docker context useworked and I’ve persisted it by settingDOCKER_CONTEXTtodesktop-linuxin the environment.@carminoplata
Good question!
Seems like any call to
docker context use(even with current context) fixes a broken reference to nonexistentmeta.jsonfile that Docker keeps somewhere for thedefaultcontext (couldn’t find it neither in the registry, nor in$env:USERPROFILE\.dockernor in$env:APPDATA…).Looks like it’s a Docker bug, possibly related to https://github.com/docker/for-win/issues/11530 or https://github.com/docker/for-win/issues/11721, because by the docs the
defaultcontext shouldn’t reference anymeta.jsonfile and indeed when it’s inspected, it says that the metadata is stored in memory:Hey @life5ign , i had the same error and what fixed the error from appearing, was to change the path to the specified in the error message (on my machine that one alphanumerical folder name was wrong)…as yourself i had no real issues besides it popping up. Hope this helps 😉