环境
查看GitLab镜像
docker search gitlab
拉取GitLab镜像
docker pull gitlab/gitlab-ce
准备gitlab-docker.yml文件
version: '3.1'
services:
gitlab:
image: 'gitlab/gitlab-ce:latest'
container_name: gitlab
restart: always
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://178.119.30.16:8929'
gitlab_rails['gitlab_shell_ssh_port'] = 2224
ports:
- '8929:8929'
- '2224:2224'
volumes:
- './config:/etc/gitlab'
- './logs:/var/log/gitlab'
- './data:/var/opt/gitlab'
启动容器(需要稍等一小会……)
docker compose -f gitlab_docker.yml up -d
查看容器日志
docker compose -f gitlab_docker.yml logs -t --tail=10
访问GitLab首页
http://178.119.30.16:8929/
查看root用户初始密码
docker exec -it gitlab cat /etc/gitlab/initial_root_password