Hi,
I am boostratpping new springboot application with JDK 17 and gradle 7.3.3
I am trying to create ci/cd pipeline as well with gitlab-ci.yml
I want to first build and package application into docker image. For that below is my yaml file
image: docker:latest
services:
- docker:dind
stages:
- build
- package
build:
image: 7.3.3-jdk17-alpine
stage: build
only:
refs:
- master
- development
script:
- ./gradlew clean build -x test
artifacts:
paths:
- build/libs/*.jar
package:
stage: package
only:
refs:
- master
- development
script:
- docker build -t registry.docke.com/imageName .
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD registry.docker.com
- docker push registry.docker.com/imageName
I am getting below exception
022-01-22T13:18:44.825510189Z time="2022-01-22T13:18:44.825351332Z" level=info msg="API listen on [::]:2375"
2022-01-22T13:18:44.825726058Z time="2022-01-22T13:18:44.825654979Z" level=info msg="API listen on /var/run/docker.sock"
*********
Pulling docker image 7.3.3-jdk17-alpine ...
WARNING: Failed to pull image with policy "always": Error response from daemon: pull access denied for 7.3.3-jdk17-alpine, repository does not exist or may require 'docker login': denied: requested access to the resource is denied (manager.go:203:0s)
ERROR: Job failed: failed to pull image "7.3.3-jdk17-alpine" with specified policies [always]: Error response from daemon: pull access denied for 7.3.3-jdk17-alpine, repository does not exist or may require 'docker login': denied: requested access to the resource is denied (manager.go:203:0s)```
It seems like it cant download image and it needed docker credentials. But I think docker:dind service should have access to docker hub ? Please educate me if I am wrong.