0

我做了一个 docker-compose 服务,它工作正常。

我安装了 minikube,我可以访问它抛出 Web 界面 http://127.0.0.1:35591/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/#/overview?namespace=default

但是当我尝试在我的 docker 文件夹上做一个“kompose up”时它失败了,见下。

似乎 kompose 尝试推送 docker.io 而不是我本地的 minikube?!

如何配置 kompose 以推送我的本地 minikube ?

INFO Building image 'ubuntu' from directory 'test-docker' 
INFO Image 'ubuntu' from directory 'test-docker' built successfully 
INFO Pushing image 'library/ubuntu:latest' to registry 'docker.io' 
WARN Unable to retrieve .docker/config.json authentication details. Check that 'docker login' works successfully on the command line.: open /home/wizard/.dockercfg: no such file or directory 
INFO Authentication credentials are not detected. Will try push without authentication. 
INFO Attempting authentication credentials 'docker.io 
ERRO Unable to push image 'library/ubuntu:latest' to registry 'docker.io'. Error: denied: requested access to the resource is denied 
FATA Error while deploying application: k.Transform failed: Unable to push Docker image for service test: unable to push docker image(s). Check that `docker login` works successfully on the command line```

Try 1 : eval $(minikube docker-env) - Failed 

```$ minikube start
  minikube v1.11.0 on Ubuntu 18.04
✨  Using the docker driver based on existing profile
  Starting control plane node minikube in cluster minikube
  Restarting existing docker container for "minikube" ...
  Preparing Kubernetes v1.18.3 on Docker 19.03.2 ...
    ▪ kubeadm.pod-network-cidr=10.244.0.0/16
  Verifying Kubernetes components...
  Enabled addons: dashboard, default-storageclass, storage-provisioner
  Done! kubectl is now configured to use "minikube"
$ eval $(minikube docker-env)
$ kompose up
INFO Build key detected. Attempting to build and push image 'ubuntu' 
INFO Building image 'ubuntu' from directory 'striper-docker' 
INFO Image 'ubuntu' from directory 'striper-docker' built successfully 
INFO Pushing image 'library/ubuntu:latest' to registry 'docker.io' 
WARN Unable to retrieve .docker/config.json authentication details. Check that 'docker login' works successfully on the command line.: open /home/wizard/.dockercfg: no such file or directory 
INFO Authentication credentials are not detected. Will try push without authentication. 
INFO Attempting authentication credentials 'docker.io 
ERRO Unable to push image 'library/ubuntu:latest' to registry 'docker.io'. Error: denied: requested access to the resource is denied 
FATA Error while deploying application: k.Transform failed: Unable to push Docker image for service striper: unable to push docker image(s). Check that `docker login` works successfully on the command line ```
4

1 回答 1

0

我猜您正在尝试执行 compose 命令以在 minikube 中启动您的服务。如果是这种情况,请执行此命令

eval $(minikube docker-env)

这会将 docker 设置为 minikube 环境。然后执行所需的 docker 命令。

eval $(minikube docker-env)在您要使用的每个终端上运行,因为它仅设置当前 shell 会话的环境变量。希望这可以帮助。

于 2020-06-08T11:03:01.850 回答