本地搭建仓库:docker+gitLab
安装docker,下载gitLab,执行以下命令:
域名需要配置本地host
sudo docker run --detach \
--hostname git.test-tool.com \
--env GITLAB_OMNIBUS_CONFIG="external_url 'http://git.test-tool.com'" \
--publish 4430:443 --publish 8000:80 --publish 2200:22 \
--name gitlab \
--restart always \
--volume /Users/mac/Documents/local_gitlab/config:/etc/gitlab \
--volume /Users/mac/Documents/local_gitlab/logs:/var/log/gitlab \
--volume /Users/mac/Documents/local_gitlab/data:/var/opt/gitlab \
--shm-size 256m \
gitlab/gitlab-ce:latest
可参考如下内容配置:
web:
image: 'gitlab/gitlab-ce:16.4.0-ce.0'
restart: always
hostname: 'git.ycheng.tech'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://git.ycheng.tech'
gitlab_rails['gitlab_shell_ssh_port'] = 2022
# Add any other gitlab.rb configuration here, each on its own line
ports:
- '83:80'
- '2022:22'
volumes:
- '/home/ubuntu/app/gitlab-16ce/gitlab/config:/etc/gitlab'
- '/home/ubuntu/app/gitlab-16ce/gitlab/logs:/var/log/gitlab'
- '/home/ubuntu/app/gitlab-16ce/gitlab/data:/var/opt/gitlab'
常用命令:
docker pull gitlab/gitlab-ce:latest //拉取 GitLab 社区版 (Community Edition, CE) 的最新镜像
docker-compose up -d // 启动命令
docker-compose down // 停止
遇到的问题:
1、一直提示权限不足,无法访问