9

I could understand, different ways to access docker image from local machine to Minikube VM.

(Kubernetes + Minikube) can't get docker image from local registry

All these examples are for Mac/Linux user.

I'm looking for an equivalent suggestion for Windows user.

What's windows equivalent to -> eval $(minikube docker-env)

mohan08p
  • 5,002
  • 1
  • 28
  • 36
manvendra
  • 461
  • 2
  • 4
  • 15

7 Answers7

18

I found relatively easy way to point docker client(docker-machine) to minikube’s docker environment by running below commands in PowerShell ->

PS C:\Users\ABC> minikube docker-env

PS C:\Users\ABC> minikube docker-env | Invoke-Expression

manvendra
  • 461
  • 2
  • 4
  • 15
  • I tried the same command from powershell. It didn't work for me. PS C:\tools\cloud> minikube docker-env $Env:DOCKER_TLS_VERIFY = "1" $Env:DOCKER_HOST = "tcp://172.27.61.204:2376" $Env:DOCKER_CERT_PATH = "C:\Users\sswain\.minikube\certs" $Env:DOCKER_API_VERSION = "1.35" # Run this command to configure your shell: # & minikube docker-env | Invoke-Expression PS C:\tools\cloud> & minikube docker-env | Invoke-Expression – Soumyajit Swain Aug 27 '18 at 12:28
  • minikube docker-env | Invoke-Expression seems to work only in PowerShell. In other terminals one needs to read the last line returned by minikube docker-env. For example, in IntelliJ it is @FOR /f "tokens=*" %i IN ('minikube -p minikube docker-env') DO @%i Have to do this in any new terminal/session always before building the docker image. – chriscross Jul 22 '20 at 04:21
4

You can use below command in the command prompt,

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

In fact when you run the command minikube docker-env it will instruct you how to connect,

enter image description here

Vijayanath Viswanathan
  • 8,027
  • 3
  • 25
  • 43
1

Like manvedra said ,those steps worked for me too. In a powershell command prompt and run the following commands:

minikube start, to start minikube cluster.

minikube docker-env, it will configure some environment variables and at bottom it will show the last command to be run.

minikube -p minikube docker-env | Invoke-Expression , last step.

Done.

IvanCl4udio
  • 55
  • 1
  • 6
  • I'm a windows user and I'm getting this error when i try to build my image after running above commands `PS C:\WINDOWS\system32> docker build -t dhruv/posts:0.0.1 .` `unable to prepare context: unable to evaluate symlinks in Dockerfile path: CreateFile C:\Windows\System32\Dockerfile: The system cannot find the file specified` – Sherry Jain Jul 07 '20 at 18:45
  • Hi @SherryJain could please check if the Dockerfile existis in the current directory where you are running the docker build command. By your messange I think that its try find dockerfile inside C:\WINDOWS\system32. You should be at the directory where Dockerfile are or specify another path with -f like: docker build -t dhruv/posts:0.0.1 . -f – IvanCl4udio Sep 11 '20 at 12:30
0

Same error and this solution doesn't work for me.

I found this solution here.

You should install docker separate way:

  1. Download choco and with it help
  2. Install docker-desktop
  3. Restart entire your machine(don't forgive do it!)
  4. Now you can do whatever you want to do with docker from command line
Ivan Vovk
  • 929
  • 14
  • 28
0

Little late to the party but you can do this on Windows:

minikube cache add alpine:latest

which gave me message that it is deprecated.

So finally use this:- minikube image load imagename

where imagename is docker daemons image name

Ref: https://minikube.sigs.k8s.io/docs/commands/image/#minikube-image-load

Appy
  • 11
  • 1
0

These are the 3 commands basically you have to run -

minikube start minikube docker-env & minikube -p minikube docker-env | Invoke-Expression

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 09 '21 at 10:58
-1

What's windows equivalent to -> eval $(minikube docker-env)

either docker-machine env my-default

or

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

Fendi jatmiko
  • 2,567
  • 1
  • 9
  • 15
  • Thanks, tried both commands, they didn't product any error although localhost docker cli, still pointing to its default docker daemon. My expectation is, post successful execution of above commands, docker-cli should point to minikube docker daemon. What else missing? – manvendra Jan 22 '18 at 11:46
  • im not sure what are you trying to do.. what you mean by **docker-cli should point to minikube docker daemon** ..? – Fendi jatmiko Jan 22 '18 at 12:26
  • I've a windows machine, use Docker Toolbox for creating Docker images etc. On the same machine, I've also installed Minikube. Both Minikube & Docker Toolbox, come with its own default Docker daemon. I want to point docker client of my machine, to Minikube docker daemon. This way, need not to unnecessarily push & pull imaged from local docker repo. – manvendra Jan 23 '18 at 05:06