Cannot docker pull with DOCKER_AUTH_CONFIG

Summary

Summarize the bug encountered concisely

I'm using the environment variable DOCKER_AUTH_CONFIG. The first pull, specified in the image tag works. The next pull/push inside the container receive a permission denied. I know I'm running docker in docker, but the DOCKER_AUTH_CONFIG make no sense to not works with this scenario.

Steps to reproduce

  1. Create gitlabi-ci.yml
...
dockerbuild:
  stage: dockerbuild
  image: privaterepo/firstimage
  script:
  - docker pull privaterepo/otherimage

2.Run the build

How one can reproduce the issue - this is very important

Actual behavior

What actually happens

Expected behavior

Pull the image

What you should see instead

Permission denied

Relevant logs and/or screenshots

Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's very hard to read otherwise. Please paste both build log and Runner's log.

CI runner logs

Running with gitlab-ci-multi-runner dev (HEAD)
Using Docker executor with image privaterepo/firstimage ...
Pulling docker image privaterepo/firstimage ...
Running on runner-..
Fetching changes...
HEAD is now at 7877a85 Update .gitlab-ci.yml
Checking out 7877a85f as dev-test...
Downloading artifacts for build (5169)...
Downloading artifacts from coordinator... ok        id=5169 responseStatus=200 OK token=Avd
$ docker pull privaterepo/otherimage
Using default tag: latest
Pulling repository privaterepo/otherimage
Error: Status 403 trying to pull privaterepo/otherimage: "{\"error\": \"Permission Denied\"}"
ERROR: Build failed: exit code 1

Environment description

Are you using shared Runners on GitLab.com? Or is it a custom installation? Which executors are used? Please also provide the versions of related tools like docker info if you are using the Docker executor.

Used GitLab Runner version

bash-4.3# gitlab-runner --version
Version:      1.9.1
Git revision: b23d3d4
Git branch:
GO version:   go1.7.4
Built:        Tue, 27 Dec 2016 15:30:25 +0000
OS/Arch:      linux/amd64
bash-4.3#