1

I recently started using Jenkins, I used JHipster to create my microservices application with angular and bootstrap ( using MySQL ).

I created three jobs since I have to build an image for each microservice:

  • FrontEnd MS (gateway)
  • BackEnd MS (products)
  • one job for the docker compose

I created two repositories in dockerhub into which I pushed those images, but when I executed the third job which contains a script shell for docker compose (docker-compose up), it doesn't find the repository for the images. and I obtained this in the console output

Started by user admin
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/third-job
using credential 39f0be78-5e11-445a-bd1b-f66a70638515
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url http://10.66.12.204/root/docker__compose.git # timeout=10
Fetching upstream changes from http://10.66.12.204/root/docker__compose.git
 > git --version # timeout=10
 > git --version # 'git version 1.8.3.1'
using GIT_ASKPASS to set credentials 
 > git fetch --tags --progress http://10.66.12.204/root/docker__compose.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 00cb1e1c79e3a0d50792d44ae1c4891dc0e95175 (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 00cb1e1c79e3a0d50792d44ae1c4891dc0e95175 # timeout=10
Commit message: "Update docker-compose.yml"
 > git rev-list --no-walk 00cb1e1c79e3a0d50792d44ae1c4891dc0e95175 # timeout=10
[third-job] $ /bin/sh -xe /tmp/jenkins7747778367305399291.sh
+ docker-compose up
Pulling gateway (gateway:)...
Trying to pull repository docker.io/library/gateway ... 
repository docker.io/gateway not found: does not exist or no pull access
Build step 'Execute shell' marked build as failure
Finished: FAILURE

this is my docker-compose.yml file :

version: '2'
services:
  gateway:
    image: gateway
    environment:
      - _JAVA_OPTIONS=-Xmx512m -Xms256m
      - 'SPRING_PROFILES_ACTIVE=prod,swagger'
      - MANAGEMENT_METRICS_EXPORT_PROMETHEUS_ENABLED=true
      - 'EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/eureka'
      - 'SPRING_CLOUD_CONFIG_URI=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/config'
      - 'SPRING_DATASOURCE_URL=jdbc:mysql://gateway-mysql:3306/gateway?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC&createDatabaseIfNotExist=true'
      - JHIPSTER_SLEEP=30
      - JHIPSTER_REGISTRY_PASSWORD=admin
    ports:
      - '8080:8080'
  gateway-mysql:
    image: 'mysql:8.0.20'
    environment:
      - MYSQL_USER=root
      - MYSQL_ALLOW_EMPTY_PASSWORD=yes
      - MYSQL_DATABASE=gateway
    command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8mb4 --explicit_defaults_for_timestamp

  products:
    image: products
    environment:
      - _JAVA_OPTIONS=-Xmx512m -Xms256m
      - 'SPRING_PROFILES_ACTIVE=prod,swagger'
      - MANAGEMENT_METRICS_EXPORT_PROMETHEUS_ENABLED=true
      - 'EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/eureka'
      - 'SPRING_CLOUD_CONFIG_URI=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/config'
      - 'SPRING_DATASOURCE_URL=jdbc:mysql://products-mysql:3306/products?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC&createDatabaseIfNotExist=true'
      - JHIPSTER_SLEEP=30
      - JHIPSTER_REGISTRY_PASSWORD=admin
  products-mysql:
    image: 'mysql:8.0.20'
    environment:
      - MYSQL_USER=root
      - MYSQL_ALLOW_EMPTY_PASSWORD=yes
      - MYSQL_DATABASE=products
    command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8mb4 --explicit_defaults_for_timestamp

  jhipster-registry:
    extends:
      file: jhipster-registry.yml
      service: jhipster-registry

Any solutions please?

MBA
  • 353
  • 2
  • 11
  • Do you need to include your Docker Hub username in the image names: `image: yourname/gateway`? – David Maze Aug 19 '20 at 13:39
  • I've tried it before, same error. – MBA Aug 19 '20 at 14:19
  • the thing is, jenkins is trying to pull the repository from the url "docker.io/library/products" which doesn't really exist, it should instead pull from docker.io/oussemabhouri/gateway , if i find how to change this url, i think the problem will be solved. what do you think? – MBA Aug 19 '20 at 14:24
  • Do you need to include your Docker Hub username in the image names, `image: oussemabhouri/gateway`? If you make that change, do you in fact get basically the same error? Without the username it's looking for an official image (like `mysql`). – David Maze Aug 19 '20 at 14:29
  • I made those changes without any successful result. I changed my image name to oussemabhouri/gateway, same thing. – MBA Aug 19 '20 at 22:58
  • Can you provide the link to your image on docker hub or is it private? – atomfrede Aug 20 '20 at 16:44
  • Please take a look at https://stackoverflow.com/a/59688329/7773582, maybe it helps. – Jochen Haßfurter Aug 21 '20 at 06:42

0 Answers0