Error pushing image to registry - unrecognized HTTP status: 400 Bad Request

Actual behavior

We used kaniko to build docker images for our gitlab registry. Before we used http to access the gitlab registry which worked and now we switched to https. Now we getting the following error: error pushing image: failed to push to destination git.company.local:5002/project:latest: unrecognized HTTP status: 400 Bad Request

We use the following description of how to setup gitlab to use the kaniko executor: https://docs.gitlab.com/ee/ci/docker/using_kaniko.html

build:
  stage: build
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE
  only:
    - tags

Has someone any idea why kaniko is still using http instead of https? We don't use --insecure-registry or --insecure.

Additional Information

  • Dockerfile
FROM php:7.2-apache

RUN apt-get update
RUN apt-get install -y p7zip-full git


RUN docker-php-ext-install mysqli pdo pdo_mysql
RUN a2enmod rewrite

COPY docker/start.sh ./
RUN chmod +x ./start.sh
COPY html ./html/
COPY services ./services/
COPY .htaccess ./

CMD ./start.sh