Problem with pulling image from private hub

1.2k Views Asked by At

I have the following problem : Trying to pull built docker image from private hub and run it as a service, but the following error appears

Failed to launch container: Failed to run 'docker -H unix:///var/run/docker.sock pull r.cfcr.io/path/to/repo/': exited with status 1; stderr='Error: Cannot perform an interactive login from a non TTY device '

here is the fetch[] config.json info that I am using to authenticate :

{
    "auths": {
        "r.cfcr.io": {
            "auth": "=auth_token="
        }
    },
    "HttpHeaders": {
        "User-Agent": "Docker-Client/18.06.1-ce (linux)"
    }
}

Do you have any idea how to resolve the problem?

2

There are 2 best solutions below

1
Kirti Azad On

Probably not linked to the problem here, but some people might encounter the exact same message when trying a docker login from a Linux like terminal on Windows such as Git bash or Docker quickstart terminal or even Cygwin.

The trick here is to use winpty docker login

or try to use this command

docker login "${URL}" -u "${Username}" -p "${PASSWORD}"
0
Parvez Kazi On

You must keep the config.json file at .docker directory at $MESOS_SANDBOX. So create the archieve of .docker directory with below listing of files :

$ tar tvf docker-login.tar                                                                                      
drwx------ parvez/parvez     0 2019-06-12 21:45 .docker/
-rw------- parvez/parvez   177 2019-06-12 21:45 .docker/config.json

Fetch and extract this archive from mesos configuration.

"fetch": [{ 
              "uri": "https://foo.com/docker-login.tar", 
              "executable": false,
              "extract": true, 
              "cache": true 
          }],

It will download and extract archieve at $MESOS_SANDBOX path and docker pull should be successful.