2

I'm running both gitlab and runner in separate containers. Gitlab is accesssible on localhost port 80 and I can clone with

http://username:[email protected]/root/citest.git

172.17.0.1 being the ip of the docker0 interface on my box However, when running any pipeline I'm getting the dreaded "You appear to have cloned an empty repository" issue. Investigation showed that the runner has the following remote:

[remote "origin"]
    url = http://gitlab-ci-token:jEZ_WtWKR4LaP63Qrk_E@b4b32c3cc3e7/root/citest.git

b4b32c3cc3e7 is the gitlab-ce container id

I guess this is because I'm running gitlab on a container and I haven't configured a specific domain name?

If my guess is correct, is there any environment variable I can set in my gitlabci.yml to adjust the location of the gitlab server?

Otherwise, is there any way where I can make the runner always know gitlab's ip which is changing?

The above is a bit specialized and maybe confusing so here's some background: I'm trying to make a devops lab for students to learn git, ci/cd and other devops-y practices on. I can only deploy this ad-hoc on my laptop on whatever ip I have at that time and ask them to connect to my box. Under these circumstances I don't see any way to set a domain or anything static in gitlab other than a container ip, right?

1 Answer 1

2

SO, instead of trying to persuade two containers to talk to each other I used docker compose, below is my docker-compose.yml

version: "2"
services:
  gitlab:
    image: 'gitlab/gitlab-ce:latest'
    restart: always
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url "http://gitlab:80"
        gitlab_rails["gitlab_shell_ssh_port"] = 2224
        gitlab_rails["lfs_enabled"] = true
        gitlab_rails["time_zone"] = "CET"
        gitlab_rails["gitlab_email_enabled"] = false
    ports:
      - '22:22'
      - '80:80'
      - '443:443'
    volumes:
      - 'gitlab_config:/etc/gitlab'
      - 'gitlab_logs:/var/log/gitlab'
      - 'gitlab_data:/var/opt/gitlab'

  gitlab-runner:
    image: 'gitlab/gitlab-runner:latest'
    restart: always
    volumes:
      - 'runner_config:/etc/gitlab-runner'
      - '/var/run/docker.sock:/var/run/docker.sock'
    depends_on:
      - gitlab
    links:
      - gitlab

volumes:
  gitlab_config:
  gitlab_logs:
  gitlab_data:
  runner_config:

This allows gitlab to be accessible on localhost but also the runner can see gitlab on http://gitlab

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.