官方文档

docker hub
https://registry.hub.docker.com/r/gitlab/gitlab-ce

安装

https://docs.gitlab.com/ee/install/docker/

初始化密码

https://docs.gitlab.com/omnibus/installation/index.html#set-up-the-initial-account

更多配置

https://docs.gitlab.com/omnibus/settings/configuration.html

注意

window 安装会有问题

这里使用ubuntu22.04LTS 安装

安装

更改服务器的 SSH 端口

您可以更改服务器的 SSH 端口,而无需在 GitLab 中再次更改 SSH 配置。在这种情况下,SSH 克隆 URL 如下所示 ssh://git@gitlab.example.com/user/project.git

  1. 使用编辑器打开 /etc/ssh/sshd_config,并更改 SSH 端口:

    1
    Port = 2424
  2. 保存文件并重新启动 SSH 服务:

    1
    sudo systemctl restart ssh

docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
services:
gitlab:
image: gitlab/gitlab-ce:latest
container_name: gitlab
restart: always
hostname: '192.168.210.4'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://192.168.210.4/'
gitlab_rails['gitlab_shell_ssh_port'] = 22
gitlab_rails['initial_root_password'] = 'Jy=git@@!23@%)('
gitlab_rails['time_zone'] = 'Beijing'
ports:
- '80:80'
- '443:443'
- '22:22'
volumes:
- '/data/gitlab/config:/etc/gitlab'
- '/data/gitlab/logs:/var/log/gitlab'
- '/data/gitlab/data:/var/opt/gitlab'

进入容器查看默认密码

1
2
docker exec -it gitlab bash
cat /etc/gitlab/initial_root_password

貌似只能utc 时间

1
docker exec -it gitlab grep 'time_zone' /etc/gitlab/gitlab.rb