1 Introduction
GitLab is a warehouse management system for open source projects, using Git as a code management tool, and build up on the basis of web services. Installation is a reference GitLab Wiki's page on GitHub.
Docker is an open source application container engine that lets developers can package their applications and dependencies into a portable mirror, and then publish to any of the popular Linux on a Windows machine or can be achieved virtualization . The container is full use of the sandbox mechanism will not have any interface with each other.
2. build GitLab
- Get gitlab mirror image
gitlab-ce
docker search gitlab
- Mirror Pull
docker pull gitlab/gitlab-ce
- View Mirror
docker images
-
Establish relevant storage folder
is created under the directory you want to store data/usr/local/gitlab/config 配置文件
/usr/local/gitlab/logs 记录日志
/usr/local/gitlab/data 存储数据
-
Boot image
execute the following command to start gitlab mirror
first start to use the run command to create a container
pay attention to your file directorydocker run --detach --publish 8443:443 --publish 8090:80 --publish 2222:22 --name gitlab --restart always --volume /usr/local/gitlab/config:/etc/gitlab --volume /usr/local/gitlab/logs:/var/log/gitlab --volume /usr/local/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce
Behind closed when restart can be started directlydocker start gitlab
- View Results
execute the following command to check the container:docker ps
Execute the following command to view the container logs:docker logs -f gitlab
- 配置账户
在浏览器中输入网址:http://localhost:8090
即可进入gitla页面
先设置自己的用户密码
设置好以后就可以直接登陆
用户名:root
密码:刚才设置的密码 - 完成
至此已经搭建好自己的gitlab环境了。 - 其它
我自己的ESC(1C2GB)配置太低了,都不敢跑,占内存比较大,建议在高一点配置的服务器上部署执行以下命令进入容器:docker exec -it gitlab bash gitlab配置文件路径:/opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml 关闭容器:docker stop gitlab