GitLab CI service

Hi guys,

I’m trying to define the CI for my project.
Since it depends on a db2 database I decide to use the CI service feature.

I’ve create my db2 docker image starting from ibmcom/db2express-c:latest
In my my image i’ve created a db2 database with some tables.
When the docker image start in a container it execute the following script:

!/usr/bin/env bash
runuser -l $USER -c "echo “Starting db2” && db2start ";
trap ‘exit 0’ SIGTERM
while true; do sleep 2; done

I’ve tested this image and I can connect to the db2 database (localhost:50000)
I’ve pushed the image to my gitlab-ce server.

In my project I’ve defined the gitlab-ci.yml as follow:

- myserver:4567/mygroup/mysubgroup/mydb2image:latest


  • test

image: myserver:4567/mygroup/mysubgroup2/myprj:latest
stage: test
- echo “======================================================”
- echo “Running tests”
- npm install
- npm test

From the web interface I can see:

Starting service myserver/mygroup/mysubgroup/mydb2image:latest …
Pulling docker image myserver:4567/mygroup/mysubgroup/mydb2image:latest …
Using docker imagemyserver:4567/mygroup/mysubgroup/mydb2image:latest ID=sha256:51cf4f8191d7ee0bcd65542bf2075c96fbbbead9d3796301274169ed33077671 for service myserver/mygroup/mysubgroup2/myprj…
Waiting for services to be up and running…
Using docker image sha256:802ac46848a0159f1663e0db4912c7134829f36a4eff95a58f36e86e6f617653 ID=sha256:802ac46848a0159f1663e0db4912c7134829f36a4eff95a58f36e86e6f617653 for predefined container…
Pulling docker image myserver:4567/mygroup/mysubgroup2/myprj:latest …

The service seems to start right, but when my test try to connect to db2 using mydb2image as host name, the test fail.

What is the right hostname that I’ve to use?

Hi, you can find the answer here:

Or cat your /etc/hosts file as a first job script action to see how the link is set.

Thanks, cat my /etc/host helped!