我在使用kubernetes(minikube)时遇到了问题,无法从Docker的本地镜像仓库中拉取镜像。 已经创建了Docker仓库:
I have problem with kubernetes (minikube) and pull images from local image repository on docker. Docker repository was created:
docker run --entrypoint htpasswd registry:2 -Bbn zordon examplePassword > /mnt/LINUX/auth/htpasswd
docker run -d \
-p 5000:5000 \
--restart=always \
--name registry \
-v /mnt/LINUX/dockerreg:/var/lib/registry \
-v /mnt/LINUX/auth:/auth \
-e "REGISTRY_AUTH=htpasswd" \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
registry:2
然后我想使用已成功上传到本地仓库的镜像创建简单的 pod:
curl localhost:5000/v2/_catalog
{"repositories":["car/configuration"]}
我也在minikube集群上创建了一个秘密:
kubectl create secret docker-registry docregkey --docker-server=localhost:5000 --docker-username=zordon --docker-password=examplePassword --docker-email=test@dock.mail
并定义简单 Pod:
apiVersion: v1
kind: Pod
metadata:
name: private-reg
spec:
containers:
- name: private-reg-container
image: car/configuration:latest
imagePullPolicy: Always
restartPolicy: Always
imagePullSecrets:
- name: docregkey
不幸的是,我还是遇到了这个问题:
无法拉取镜像"car/configuration:latest": rpc错误:代码= Unknown desc =守护程序的错误响应:拉取被拒绝,因为可能需要'docker login'登录。
我该如何解决这个问题?