title: GitLab CI login to private repo without DinD
body: <p>I'm new to GitLab and not sure if this is possible, I have on premise GitLab set up and working as well as Artifactory private repo.</p>
  
  <p>I always used DinD configuration, using Docker as the main image with DinD service, then in the stages logging in and pulling different images from the private repo.</p>
  
  <p>But I heard it's possible to do this without DinD to have shorter execution times. And the needed image is pulled in the beginning of a stage.</p>
  
  <p>Instead of this:</p>
  
  <pre><code>image: docker:latest
  
  services:
    - docker:18.09.8-dind
  
  variables:
    DOCKER_DRIVER: overlay2
    DOCKER_HOST: tcp://localhost:2375 
  
  stages:
    - run_script
  
  run_script:
    stage:
      run_script
    script:
      - docker login -u $DOCKER_TECHNICAL_USER -p $DOCKER_TECHNICAL_USER_PASSWORD $DOCKER_REGISTRY_URL
      - docker pull artifactory.example.com:5000/repo/powershell-core:6.3
      - docker run -it artifactory.example.com:5000/repo/powershell-core:6.3 pwsh -command "get-process"
  </code></pre>
  
  <p>I want to do it like this(whole yml):</p>
  
  <pre><code>stages:
    - run_script
  
  run_script:
    before_script:
      - docker login -u $DOCKER_TECHNICAL_USER -p $DOCKER_TECHNICAL_USER_PASSWORD $DOCKER_REGISTRY_URL
    image: artifactory.example.com:5000/repo/powershell-core:6.3
    stage:
      run_script
    script:
      - pwsh -command "get-process"
  </code></pre>
  
  <p>If I try this it says it can't authenticate:</p>
  
  <pre><code>ERROR: Job failed: image pull failed: rpc error: code = Unknown desc = Get https://artifactory.example.com:5000/v2/repo/powershell-core/manifests/6.3: unknown: Authentication is required
  </code></pre>
  
  <p>Is this impossible or do I have a mistake somewhere and it's fixable?</p>