CICD 入门篇(一) 搭建Gitlab服务器
一丶环境准备
- 创建一个全新的虚拟机,并且至少指定4G的运行内存
- 安装docker以及docker-compose
- docker-compose.yml文件去安装gitlab
二丶 docker-compose.yml
version: '3.1' services: gitlab: image: 'twang2218/gitlab-ce-zh:11.1.4' #指定镜像路径 container_name: "gitlab" #指定容器名称 restart: always privileged: true hostname: 'gitlab' environment: TZ: Asia/Shanghai #指定时区 GITLAB_OMNIBUS_CONFIG: | external_url = 'http:192.168.199.100' gitlab_rails['time_zone'] = 'Asia/Shanghai' gitlab_rails['smtp_enable'] = true gitlab_rails['gitlab_shell_ssh_port'] = 22 ports: - '80:80' - '443:443' - '22:22' volumes: - /opt/docker_gitlab/config:/etc/gitlab #映射数据卷 - /opt/docker_gitlab/data:/var/opt/gitlab - /opt/docker_gitlab/logs:/var/log/gitlab
三丶具体步骤
cd /opt
mkdir docker_gitlab
vi docker-compose.yml
复制黏贴进去
解决22端口被占用
将ssh 端口22换掉 改成其他
参考地址:https://blog.csdn.net/mrqiang9001/article/details/78308830
在 docker_gitlab目录下 运行:docker-compose up -d
查看日志:docker-compose logs -f
进入gitlab页面 ip:80