I'm using Minikube in Windows 10 and I'd like to use locally built Docker images instead of images hosted in a registry, so, according this tutorial, I have to run next commands:
Use local kubernetes and images:
> minikube docker-env
The output is:
PS C:\WINDOWS\system32> minikube docker-env
$Env:DOCKER_TLS_VERIFY = "1"
$Env:DOCKER_HOST = "tcp://10.98.38.126:2376"
$Env:DOCKER_CERT_PATH = "C:\Users\MyUser\.minikube\certs"
# Run this command to configure your shell:
# & minikube docker-env | Invoke-Expression
To configure the shell, run this:
> & minikube docker-env | Invoke-Expression
After that, I need to build a new image:
PS D:\repos\test> docker build -t miImage:v1 .
And I have next error:
PS D:\repos\test> docker build -t miImage:v1 .
Sending build context to Docker daemon 8.62MB
Step 1/10 : FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env
Get https://mcr.microsoft.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
This is error is thrown since I configured it to use local images, is there any way to fix it?
it looks like the machine that you're using to build is unable to reach https://mcr.microsoft.com/v2/ to confirm that, try to send a simple GET to the URL
wget https://mcr.microsoft.com/v2/
if that's the problem, you can use a different machine to pull the image, then save it to a file and load it on the target machine.
#on a machine connected to internet
docker pull mcr.microsoft.com/dotnet/core/sdk:2.2
docker save mcr.microsoft.com/dotnet/core/sdk:2.2 > dotnetsdk2_2.tar
# download the file
# on the target machine
docker load < dotnetsdk2_2.tar
then your build should work without a problem using the local version of the image.