0

So far I made 2 docker container using Docker Engine and Docker Compose for a CI proof of concept. The first one is Jenkins and the other one is Gitlab CE.

Here are the version

Docker version 19.03.6
docker-compose version 1.25.4

and I have a docker-compose.yml that works perfectly fine to launch both containers

version: "3"

services:
  gitlab:
    image: 'gitlab/gitlab-ce:latest'
    container_name: "gitlab-ci"
    restart: "always"
    hostname: "gitlab.example.com"
    ports:
      - "8081:80"
    volumes:
      - "/srv/gitlab/config:/etc/gitlab"
      - "/srv/gitlab/logs:/var/log/gitlab"
      - "/srv/gitlab/data:/var/opt/gitlab"
    environment:
      GITLAB_OMNIBUS_CONFIG: |
    external_url "http://gitlab"
  jenkins:
    image: "jenkins/jenkins:lts"
    container_name: "jenkins-ci"
    restart: "always"
    ports:
      - "8080:8080"
      - "50000:50000"
    volumes:
      - "/home/USER/jenkinsci_docker:/var/jenkins_home"

However the both seems not to be able to communicate between each others,

because I cannot add the Repository URL in Jenkins and I have the following error:

Jenkins screenshot

I checked and the URL of my local Gitlab CE container works on the host http//:localhost:8081/root/simple-java-maven-app

I am using Ubuntu if it may help. Thanks for reading if I can provide any more information feel free to ask me

0

Add a the following to the Jenkins service section:

    jenkins:
    ...
      links:
        - gitlab

This will make the Gitlab container available at http://gitlab:8081/... documentation

You could also add a virtual network, but since it's just two containers I'd recomend this.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.