Push docker image to GitLab registry from GitLab CI

registry
docker

#1

Hello,
this is my .gitlab-ci.yml file:

stages:
- build
- deploy

build:
  stage: build
  when: on_success
  only:
    - master
  image: docker:stable
  services:
    - docker:dind
  script:
    - docker login registry.gitlab.com
    - docker build -t registry.gitlab.com/hytta-iot/hytta.io .
    - docker push registry.gitlab.com/hytta-iot/hytta.io

I do not understand how I can login to registry.gitlab.com. Since I need to pass username and password, but I cannot just commit them, how would you do it? I am surprised I cannot find one single guide that explains this directly.

Thank you


#2

Hi @lucavallin.
Any success with this? I am trying to achieve exactly the same on our setup