Search code examples
dockerdocker-composegitlabhostsgitlab-ce

Repo file links of gitlab-ce service in docker container redirect to 404 page


I try to run gitlab as a docker service on my local machine. The git and web functionality seems to work fine. Except when I try to open a file in a repo to view the content I'm redirected to a 404 page.

The URL which was generated to access the file looks as follows:

http://www/user/tesproject/-/blob/master/file.py

If I change the URL manually to:

http://192.168.122.168:8080/user/tesproject/-/blob/master/file.py

... everything works as expected. (192.168.122.168 is the host's ip.)

Does anybody know what changes I have to make so that it redirects to the correct URL?

My guess is, that domainname and hostname in my docker-compose file is somehow wrong.

My docker-compose.yml:

version: '3.7'
services:
  # GitLab
  gitlab-web:
    image: gitlab/gitlab-ce:latest
    restart: always
    container_name: gitlabweb
    domainname: gitlabweb.dev
    hostname: www
    volumes:
      - ./gitlab-config:/etc/gitlab
      - ./gitlab-logs:/var/log/gitlab
      - ./gitlab-data:/var/opt/gitlab
    ports:
      - '2222:22'
      - '8080:80'
      - '443:443'
      - '4567:4567'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        gitlab_rails['gitlab_shell_ssh_port'] = 2222
        registry_external_url 'http://localhost:4567'
        registry['enable'] = true
        unicorn['socket'] = '/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket'
    networks:
      - gitlab-network

networks:
  gitlab-network:
    name: gitlab-network

My /etc/hosts on the local host contains:

...
192.168.96.2    www.gitlabweb.dev
...

Pinging www.gitlabweb.dev works. (192.168.96.2 is the gitlab container's ip.)

I use: Ubuntu Server 20.04, Docker version 19.03.11

Thanks for your help!


Solution

  • Installing the docker image gitlab/gitlab-ce version 13.4.4 solved the problem. Before I had 13.2.4.