Docker compose Kompose up:无法检索.docker/config.json

Docker compose Kompose up:无法检索.docker/config.json,docker-compose,minikube,kompose,Docker Compose,Minikube,Kompose,我正在用kompose在Mac上转换一个简单的docker compose文件。但每次我跑起来,我都会: WARN Unable to retrieve .docker/config.json authentication details. Check that 'docker login' works successfully on the command line.: Failed to read authentication from dockercfg INFO Authenticat

我正在用kompose在Mac上转换一个简单的docker compose文件。但每次我跑起来,我都会:

WARN Unable to retrieve .docker/config.json authentication details. Check that 'docker login' works successfully on the command line.: Failed to read authentication from dockercfg 
INFO Authentication credentials are not detected. Will try push without authentication. 
INFO Attempting authentication credentials 'docker.io 
ERRO Unable to push image 'bolbeck/simplepythonimage: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 firstpythonhw: unable to push docker image(s). Check that `docker login` works successfully on the command line 
kompose convert工作正常,因为它不会尝试拉取图像。另外,
docker登录
在终端上运行正常,我可以手动推送图像

以下是docker compose文件:

version: "3"

services:
  firstpythonhw:
    build: .
    image: MyAccount/pythonimage
    container_name: pythonhw
    ports:
      - "5000:5000"
我使用的是Kompose 1.18.0版和Minikube 1.4.0版

根据文档,在图像操作期间,Docker身份验证数据实际上是按照以下文件夹检查顺序从Docker配置文件中检索的:

$DOCKER_CONFIG/config.json, $HOME/.docker/config.json , $HOME/.dockercfg
事实上,当您通过
docker login
登录到注册表时,该命令将凭证保存在
config.json
文件中。然而,Docker还提供了一种方法,可以通过将用户身份验证数据作为主存储器存储在外部,即使是操作系统范围的密钥链。但这次
Kompose
将无法识别Docker配置文件和整个内容结构

在Mac中,您可以找到,因为您已经检查了
docker login
,我假设base64编码的凭证没有存储在
config.json
文件中,它们只是被导出到特定macOS上的“osxkeychain”中

更新:

典型的
config.json
文件结构:

{
        "auths": {
                "https://index.docker.io/v1/": {
                        "auth": "base64 encoded username:password"
                }
        },
        "HttpHeaders": {
                "User-Agent": "Docker-Client/18.09.7 (linux)"
        }
}

请尝试以下命令在您的计算机上生成base64字符串

echo -n 'username:password'  | base64
拿这个的输出来说

并添加到docker compose文件中

{
        "auths": {
                "https://index.docker.io/v1/": {
                        "auth": "your base 64 string"
                }
        },
        "HttpHeaders": {
                "User-Agent": "Docker-Client/18.09.7 (linux)"
        }
}

我刚刚检查了$HOME/.docker/config.json,但是base64凭证不在那里。这就是auth的全部内容:“auths”:{“index.docker.io/v1”:{}。那么,有没有办法让Kompose查看钥匙链或强制将凭证推送到配置文件中?谢谢嗯,我想您可以手动提供
“auth”
值,将docker凭证编码为base64:
echo“username:password”| base64