title: CI/CD Gitlab with Harbor Registry
body: <p>I have 3 server</p>
  <ol>
  <li>Gitlab</li>
  <li>Gitlab Runner</li>
  <li>Harbor Registry</li>
  </ol>
  <p>When I run CI/CD on Gitlab but it cannot login to Harbor Registry. This is error.</p>
  <pre><code>Get https://172.21.5.247/v1/users/: x509: cannot validate certificate for 172.21.5.247 because it doesn't contain any IP SANs
  </code></pre>
  <p>When I try login docker on server Gitlab and Gitlab Runner is successfully. I added &quot;insecure-registries&quot; to two server.
  <a href="https://i.stack.imgur.com/3FGw4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3FGw4.png" alt="enter image description here" /></a></p>
  <p>.gitlab.ci.yml file</p>
  <pre><code>image: docker:18-git
  
  variables:
    DOCKER_DRIVER: overlay2
    DOCKER_TLS_CERTDIR: &quot;&quot;
    DOCKER_HOST: tcp://localhost:2375
  
  stages:
    - build
    - push
  services:
    - name: docker:dind
      command: [&quot;--insecure-registry=172.21.5.247:443&quot;]
  
  before_script:
    - echo $HARBOR_USERNAME
    - echo -n $HARBOR_PASSWORD | docker login -u $HARBOR_USERNAME -p $HARBOR_PASSWORD $HARBOR_REGISTRY
    - docker version
    - docker info
  
  after_script:
    - docker logout $HARBOR_REGISTRY
  
  Build:
    stage: build
    script:
      - docker pull $HARBOR_REGISTRY_IMAGE:latest || true
      - &gt;
        docker build
        --pull
        --cache-from $HARBOR_REGISTRY_IMAGE:latest
        --tag $HARBOR_REGISTRY_IMAGE:$CI_COMMIT_SHA .
      - docker push $HARBOR_REGISTRY_IMAGE:$CI_COMMIT_SHA
  
  Push_When_tag:
    stage: push
    only:
      - tags
    script:
      - docker pull $HARBOR_REGISTRY_IMAGE:$CI_COMMIT_SHA
      - docker tag $HARBOR_REGISTRY_IMAGE:$CI_COMMIT_SHA $HARBOR_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
      - docker push $HARBOR_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
  
  </code></pre>
  <p>It have error in docker login.</p>