运行 Minikube 中的本地 docker 镜像
Running local docker image in Minikube
我已经为 Windows 和 minikube 设置了 Docker。此处为 (k8s.gcr.io/echoserver:1.10) 列出的示例工作得很好:
https://kubernetes.io/docs/setup/learning-environment/minikube/。
然而,当我在 c:\dev\helloworld 下创建简单的 .NET MVC 应用程序并尝试在 Minikube 中 运行 时,我得到状态:CrashLoopBackOff
环境:Windows 10 个企业
请帮忙。我需要设置什么才能使这项工作?
如果您在 运行 docker build
而不是 Docker Windows 守护进程 运行ning 在主机上,然后 minikube Docker 将可以访问该图像,随后的 kubectl run
命令将按需要工作。我不确定 Windows 上 运行 的确切命令,但在 POSIX 系统(如 Mac 或 Linux 上,您可以 运行:
# make 'docker' commands use daemon in minikube
eval $(minikube docker-env)
# build image so that minikube Docker daemon has it
docker build -t hello-world:v1 .
# deploy to kubernetes
kubectl run hello-world --image=hello-world:v1 --port=8080
# unset DOCKER environment variables so it goes back to
# targetting the usual Docker for Windows
eval $(minikube docker-env -u)
我不知道 eval
在 Windows 上 运行 是否正确,但如果你只是 运行 minikube docker-env
它可能会给你一些指示,例如对我来说:
$ minikube docker-env
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.103:2376"
export DOCKER_CERT_PATH="/Users/amitgupta/.minikube/certs"
# Run this command to configure your shell:
# eval $(minikube docker-env)
我已经为 Windows 和 minikube 设置了 Docker。此处为 (k8s.gcr.io/echoserver:1.10) 列出的示例工作得很好: https://kubernetes.io/docs/setup/learning-environment/minikube/。
然而,当我在 c:\dev\helloworld 下创建简单的 .NET MVC 应用程序并尝试在 Minikube 中 运行 时,我得到状态:CrashLoopBackOff
环境:Windows 10 个企业
请帮忙。我需要设置什么才能使这项工作?
如果您在 运行 docker build
而不是 Docker Windows 守护进程 运行ning 在主机上,然后 minikube Docker 将可以访问该图像,随后的 kubectl run
命令将按需要工作。我不确定 Windows 上 运行 的确切命令,但在 POSIX 系统(如 Mac 或 Linux 上,您可以 运行:
# make 'docker' commands use daemon in minikube
eval $(minikube docker-env)
# build image so that minikube Docker daemon has it
docker build -t hello-world:v1 .
# deploy to kubernetes
kubectl run hello-world --image=hello-world:v1 --port=8080
# unset DOCKER environment variables so it goes back to
# targetting the usual Docker for Windows
eval $(minikube docker-env -u)
我不知道 eval
在 Windows 上 运行 是否正确,但如果你只是 运行 minikube docker-env
它可能会给你一些指示,例如对我来说:
$ minikube docker-env
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.103:2376"
export DOCKER_CERT_PATH="/Users/amitgupta/.minikube/certs"
# Run this command to configure your shell:
# eval $(minikube docker-env)