Post

Ubuntu에 Docker 이미지로 GitLab 설치

1. GitLab Docker 이미지 pull

GitLab 최신 안정된 릴리즈 latest 이미지를 pull 한다.

1
$ sudo docker pull gitlab/gitlab-ce:latest

2. Docker 사용

1) 이미지 실행

1
2
3
4
5
6
7
8
9
10
11
$ sudo docker run --detach \
    --hostname 127.0.0.1 \
    --env GITLAB_OMNIBUS_CONFIG="external_url 'http://127.0.0.1'" \
    --publish 443:443 --publish 80:80 --publish 2222:22 \
    --name gitlab \
    --restart always \
    --volume ~/gitlab/config:/etc/gitlab \
    --volume ~/gitlab/logs/var/log/gitlab \
    --volume ~/gitlab/data:/var/opt/gitlab \
    --volume ~/gitlab/backups:/var/opt/gitlab/backups \
    gitlab/gitlab-ce:latest

3. Docker Compose 사용

1) docker-compose.yml 생성

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
version: '3.9'
services:
  gitlab:
    image: gitlab/gitlab-ce:latest
    container_name: gitlab
    restart: always
    hostname: '127.0.0.1'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        # Add any other gitlab.rb configuration here, each on its own line
        external_url 'http://127.0.0.1:8880'
        gitlab_rails['gitlab_shell_ssh_port'] = 2224
        nginx['listen_port'] = 80
        nginx['enable'] = true
        nginx['redirect_http_to_https'] = true
        registry_nginx['redirect_http_to_https'] = true
        mattermost_nginx['redirect_http_to_https'] = true
    ports:
      - '80:80'
      - '443:443'
      - '2222:22'
    volumes:
      - '~/gitlab/config:/etc/gitlab'
      - '~/gitlab/logs:/var/log/gitlab'
      - '~/gitlab/data:/var/opt/gitlab'
      - '~/gitlab/backups:/var/opt/gitlab/backups'

2) docker-compose 실행

1
$ sudo docker-compose up -d

4. GitLab 접속

1
http://127.0.0.1

1) 초기 root 비밀번호 확인

초기 비밀번호로 로그인 후 새로운 비밀번호로 변경한다.

1
$ sudo docker exec -it gitlab grep 'Password' /etc/gitlab/initial_root_password

[출처 및 참고]

This post is licensed under CC BY 4.0 by the author.