<p>I installed GitLab runner via <a href="https://docs.gitlab.com/runner/install/kubernetes.html" rel="nofollow noreferrer">HelmChart</a> on my <code>Kubernetes</code> cluster</p>
<p>While installing via helm I used config <code>values.yaml</code></p>
<p>But my Runner stucks every time at <code>docker login</code> command,
without <code>docker login</code> working good</p>
<p>I have no idea what is wrong :(
<strong>Any help appreciated!</strong></p>
<p><strong>Error:</strong> <code>write tcp 10.244.0.44:50882-&gt;188.72.88.34:443: use of closed network connection</code></p>
<p><a href="https://i.stack.imgur.com/vVOn4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vVOn4.png" alt="enter image description here" /></a></p>
<p><code>.gitlab-ci.yaml</code> file</p>
<pre><code>build docker image:
  stage: build
  image: docker:latest
  services:
    - name: docker:dind
      entrypoint: [&quot;env&quot;, &quot;-u&quot;, &quot;DOCKER_HOST&quot;]
      command: [&quot;dockerd-entrypoint.sh&quot;]
  variables:
    DOCKER_HOST: tcp://localhost:2375/
    DOCKER_DRIVER: overlay2
    DOCKER_TLS_CERTDIR: &quot;&quot;
  before_script:
     - mkdir -p $HOME/.docker
     - echo passwd| docker login -u user https://registry.labs.com --password-stdin
     
  script:
    - docker images
    - docker ps
    - docker pull registry.labs.com/jappweek:a_zh
    - docker build -t &quot;$CI_REGISTRY&quot;/&quot;$CI_REGISTRY_IMAGE&quot;:1.8 .  
    - docker push &quot;$CI_REGISTRY&quot;/&quot;$CI_REGISTRY_IMAGE&quot;:1.8
   
  tags:
  - k8s
</code></pre>
<p><code>values.yaml</code> file</p>
<pre><code>image:
  registry: registry.gitlab.com
  #image: gitlab/gitlab-runner:v13.0.0
  image: gitlab-org/gitlab-runner
  # tag: alpine-v11.6.0


imagePullPolicy: IfNotPresent


gitlabUrl: https://gitlab.somebars.com


runnerRegistrationToken: &quot;GR1348941a7jJ4WF7999yxsya9Arsd929g&quot;


terminationGracePeriodSeconds: 3600

#
concurrent: 10


checkInterval: 30


sessionServer:
  enabled: false
 
## For RBAC support:
rbac:
  create: true

 
  rules: 
   - resources: [&quot;configmaps&quot;, &quot;pods&quot;, &quot;pods/attach&quot;, &quot;secrets&quot;, &quot;services&quot;]
     verbs: [&quot;get&quot;, &quot;list&quot;, &quot;watch&quot;, &quot;create&quot;, &quot;patch&quot;, &quot;update&quot;, &quot;delete&quot;]
   - apiGroups: [&quot;&quot;]
     resources: [&quot;pods/exec&quot;]
     verbs: [&quot;create&quot;, &quot;patch&quot;, &quot;delete&quot;]


  clusterWideAccess: false

 
  podSecurityPolicy:
    enabled: false
    resourceNames:
    - gitlab-runner

  
metrics:
  enabled: false

  
  portName: metrics

 
  port: 9252

 
  serviceMonitor:
    enabled: false

  
service:
  enabled: false

 
  
  type: ClusterIP

  
runners:
 
  config: |
    [[runners]]
      [runners.kubernetes]
        namespace = &quot;{{.Release.Namespace}}&quot;
        image = &quot;ubuntu:16.04&quot;


  privileged: true

  cache: {}
    

  builds: {}
  
  services: {}
 
  helpers: {}
  
 
 
securityContext:
  allowPrivilegeEscalation: false
  readOnlyRootFilesystem: false
  runAsNonRoot: true
  privileged: false
  capabilities:
    drop: [&quot;ALL&quot;]


podSecurityContext:
  runAsUser: 100
  # runAsGroup: 65533
  fsGroup: 65533
 
resources: {}
 
affinity: {}


nodeSelector: {}
 
tolerations: []

hostAliases: []
 
podAnnotations: {}
  
podLabels: {}
  
priorityClassName: &quot;&quot;


secrets: []
 
configMaps: {}


volumeMounts: []

volumes: []
</code></pre>

Shukurillo Baikhanov
<p>I bypassed <code>docker login</code> with importing <code>$HOME/.docker/config.json</code> file which stores <code>auth token</code> from my host machine to Gitlab Ci</p>
<pre><code> before_script:
     - mkdir -p $HOME/.docker
     - echo $DOCKER_AUTH_CONFIG &gt; $HOME/.docker/config.json
</code></pre>
<p><code>$DOCKER_AUTH_CONFIG</code> is <code>$HOME/.docker/config.json</code></p>
<p>That's all no <code>docker login</code> required</p>
