How to use .dockercfg to pull private images with Kubernetes

11/6/2015

I am attempting to pull private docker images from Docker Hub.

Error: image orgname/imagename:latest not found

The info I am seeing on the internet...

Leads me to believe I should be able to put something like

{
    "https://index.docker.io/v1/": {
        "auth": "base64pw==",
        "email": "email@place.com"
    }
}

In the kubelet uer's $HOME/.dockercfg and kublet will then authenticate with the container registry before attempting to pull.

This doesn't appear to be working. Am I doing something wrong? Is this still possible?

I am using the vagrant provisioner located in https://github.com/kubernetes/kubernetes/tree/master/cluster

Also: I am aware of the ImagePullSecrets method but am trying to figure out why this isn't working.

Update:

I moved /root/.dockercfg to /.dockercfg and it now appears to be pulling private images.

-- frodopwns
kubernetes

1 Answer

11/6/2015

From: https://github.com/kubernetes/kubernetes/pull/12717/files

This function func ReadDockerConfigFile() (cfg DockerConfig, err error) is used to parse config which is stored in:

GetPreferredDockercfgPath() + "/config.json"
workingDirPath + "/config.json"
$HOME/.docker/config.json
/.docker/config.json
GetPreferredDockercfgPath() + "/.dockercfg"
workingDirPath + "/.dockercfg"
$HOME/.dockercfg
/.dockercfg

The first four one are new type of secret, and the last four one are the old type.

This helps explain why moving the file to /.dockercfg fixed your issue, but not why there was an issue in the first place.

-- pwittrock
Source: StackOverflow