Docker-machine + Gitlab registry - how to make authentication work?

I’m trying to build a Docker image on a docker-machine host and push that image to Gitlab registry. I enabled the registry, then used docker-machine as described HERE (with the exception that I used as host IP, but it worked after a trivial change in Gitlab Runner configuration). The problem is that after building the image, when I try to push it, I get the following error:

$ docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN
Login Succeeded
$ docker build -t .
(build went fine)
$ docker push
The push refers to a repository []
9da290505e25: Preparing
4edf62705ffc: Preparing
9845b0e669c4: Preparing
0dd280e9ab09: Preparing
1efea06cfe5b: Preparing
cf516324493c: Preparing
cf516324493c: Waiting
denied: access forbidden
ERROR: Job failed: exit code 1

Here’s my .gitlab-ci.yml:

image: my-base-image

    DOCKER_HOST: "tcp://"
    DOCKER_CERT_PATH: "certs"

  - echo "$CA" > $DOCKER_CERT_PATH/ca.pem
  - echo "$CLIENT_CERT" > $DOCKER_CERT_PATH/cert.pem
  - echo "$CLIENT_KEY" > $DOCKER_CERT_PATH/key.pem\
  - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN
  - docker build -t .
  - docker pull

My theory is that certificate from $DOCKER_CERT_PATH is used both for connecting with docker-machine host and Gitlab registry. Is that possible? Can I force login/password authentication for Gitlab Registry or generate a key that CI could use?