1. docker-compose.yml 작성
GitLab Port >> 80 : http, 443 :https, 8080 : unicorn, 22 : ssh
version: "3.1"
services:
gitlab:
image: gitlab/gitlab-ce:latest
container_name: gitlab
hostname: gitlab.com //host주소. 제외하는 경우 localhost로 설정
restart: always
ports:
- "8888:8888" //http (원하는 포트번호로 설정. default : 80)
- "2222:2222" //ssh (원하는 포트번호로 설정. defuault : 22)
networks:
- bridge_network
environment: //접속 주소 및 ssh port 설정(기본 값인 경우 생략)
GITLAB_OMNIBUS_CONFIG:
external_url 'http://gitlab.com:8888';
gitlab_rails['gitlab_shell_ssh_port'] = 2222
volumes:
- data_host_dir:/var/opt/gitlab
- log_host_dir:/var/log/gitlab
- config_host_dir:/etc/gitlab
networks:
bridge_network:
driver: bridge
2. GitLab Container 환경 구축
# docker-compose up -d
3. GitLab 설정 변경
docker-compose.yml에서 environment 설정을 하지 않은 경우.
GitLab > /etc/gitlab/gitlab.rb 내용을 수정해준다.
> docker exec –it gitlab /bin/bash
/# cd /etc/gitlab/
/etc/gitlab/# vi gitlab.rb
---vi gitlab.rb---
###GitLab URL
external_url 'http://gitlab.com:8888'
### GitLab Shell settings for GitLab
gitlab_rails['gitlab_shell_ssh_port'] = 2222
4. GitLab 접속
http://gitlab.com:8888 로 접속
5. root 계정 비밀번호 변경하기
> docker exec -it gitlab /bin/bash
/# gitlab-rails console -e production
irb(main):005:0> user = User.where(id:1).first
=> #<User id:1 @root>
irb(main):006:0> user.password='newpassword'
=> "newpassword"
irb(main):007:0> user.password_confirmation='newpassword'
=> "newpassword"
irb(main):008:0> user.save
Enqueued ActionMailer::MailDeliveryJob (Job ID: c189f6f8-8be0-4066-ba50-ba6fe4b06638) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f8ab4385928 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
'Docker' 카테고리의 다른 글
Docker bind mount 경로 volume 으로 복사하기 (0) | 2023.11.06 |
---|---|
Docker Hub 이미지 업로드 (0) | 2023.11.06 |
docker-compose.yml & backup script (0) | 2023.06.01 |
Docker 기본 명령어 (0) | 2023.06.01 |
Docker Root Directory 변경하기(Linux) (0) | 2021.08.09 |