본문 바로가기

리눅스

GitLab을 Docker Compose를 사용하여 올리는 방법

728x90

GitLab을 Docker Compose를 사용하여 올리는 방법

  • gitlab 디렉토리 생성
mkdir -p gitlab
  • gitlab 디렉토리 소유자 설정
chown -R 999:999 gitlab
  • gitlab 디렉토리 권한 설정
chmod -R 755 gitlab
  • Docker Compose 파일 작성
vim docker-compose.yml
version: '3.8'
services:

  ### 16.10.1-ee.0
  gitlab:
    image: gitlab/gitlab-ee:latest
    container_name: gitlab
    restart: always
    hostname: gitlab.sangchul.kr
    #env_file: .env
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'https://gitlab.sangchul.kr'
        gitlab_rails['gitlab_shell_ssh_port'] = 2222
    volumes:
      - /usr/share/zoneinfo/Asia/Seoul:/etc/localtime:ro
      - ./gitlab/config:/etc/gitlab:rw
      - ./gitlab/data:/var/opt/gitlab:rw
      - ./gitlab/logs:/var/log/gitlab:rw
      - ./gitlab/backups:/var/opt/gitlab/backups
    shm_size: '256m'
    ports:
      - "2222:22"
      - "8080:80"
      - "8443:443"
      - "5000:5000"
    networks:
      - gitlab_net 

networks:
  gitlab_net:
    name: gitlab_net
vim .env
### GITLAB
GITLAB_EMAIL=gitlab@example.com
GITLAB_HOST=gitlab.example.com
728x90

Gitlab_WEB_1

  • Docker Compose 파일의 구성 확인
docker compose config
  • 컨테이너 실행
docker compose up -d
  • 컨테이너 상태 확인
docker compose ps
  • 컨테이너 중지
docker compose down -v
  • 컨테이너 로그 확인
docker compose logs -f
  • gitlab-ctl status
docker compose exec gitlab gitlab-ctl status
$ docker compose exec gitlab gitlab-ctl status
run: alertmanager: (pid 778) 100s; run: log: (pid 565) 154s
run: gitaly: (pid 274) 179s; run: log: (pid 271) 179s
run: gitlab-exporter: (pid 732) 103s; run: log: (pid 466) 170s
run: gitlab-kas: (pid 386) 173s; run: log: (pid 381) 173s
run: gitlab-workhorse: (pid 392) 173s; run: log: (pid 387) 173s
run: logrotate: (pid 273) 179s; run: log: (pid 270) 179s
run: nginx: (pid 390) 173s; run: log: (pid 384) 173s
run: postgres-exporter: (pid 805) 100s; run: log: (pid 611) 146s
run: postgresql: (pid 385) 173s; run: log: (pid 380) 173s
run: prometheus: (pid 743) 102s; run: log: (pid 532) 158s
run: puma: (pid 599) 147s; run: log: (pid 383) 173s
run: redis: (pid 275) 179s; run: log: (pid 272) 179s
run: redis-exporter: (pid 734) 103s; run: log: (pid 488) 166s
run: sidekiq: (pid 636) 138s; run: log: (pid 382) 173s
run: sshd: (pid 34) 194s; run: log: (pid 33) 194s
  • GitLab의 초기 root 비밀번호 확인
docker compose exec gitlab grep 'Password:' /etc/gitlab/initial_root_password
$ docker compose exec gitlab grep 'Password:' /etc/gitlab/initial_root_password
Password: JEYD9wuawacOolgjaG87BjU4GTvtS+9PkmbRt/2+S0w=
  • GitLab 웹 인터페이스
    • root /

Gitlab_WEB_2

  • GitLab 웹 인터페이스를 통한 비밀번호 변경

Gitlab_WEB_3

 

참고URL

- GitLab Docs : Install GitLab by using Docker

- GitLab Docs : Reset a user’s password

- GitLab Docs : Configuration options for Linux package installations

- GitLab.org : omnibus-gitlab(GitLab 구성 설정)

 

728x90