Search code examples
docker-composeminikubekompose

Kompose up: Unable to retrieve .docker/config.json


I am converting a simple docker-compose file on my Mac with kompose. But every time I run kompose up I get :

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 works fine, since it does not try to pull the image. Also docker login works just fine from the terminal and I can push images manually.

Here is the docker-compose file:

version: "3"

services:
  firstpythonhw:
    build: .
    image: MyAccount/pythonimage
    container_name: pythonhw
    ports:
      - "5000:5000"

I am using Kompose version 1.18.0 and Minikube version 1.4.0


Solution

  • According to Kompose documentation, during Push image action, Docker authentication data is actually retrieved from docker config file in the following folder check sequence:

    $DOCKER_CONFIG/config.json, $HOME/.docker/config.json , $HOME/.dockercfg
    

    In fact, when you log to the registry via docker login, the command saves credentials in config.json file. However, Docker also offers a way how to externally store user authentication data via Credential stores as a main storage for even OS wide key-chains. But this time Kompose will not recognize Docker configuration file and entire content structure.

    In Mac you can find macOS keychain, since you've checked docker login I suppose that base64 encoded credentials were not stored in config.json file, they just being exported to “osxkeychain” on the particular macOS.

    Update:

    Typical config.json file structure:

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