docker/gitlab/gitlab.md
2018-06-27 12:27:09 +08:00

45 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# docker gitlab 搭建
## 安装docker
基础环境centos 7
```bash
yum remove docker docker-common docker-selinux docker-engine
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce
```
## 修改docker存储路径
```bash
vim /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --graph /opt/docker
```
## 更换国内docker源
vim /etc/docker/daemon.json
```json
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
```
## 启动docker
```bash
systemctl start docker
systemctl enable docker
```
## 下载镜像
```bash
docker pull gitlab/gitlab-ce
```
## 启动容器
```bash
docker run -d \
--hostname git.yangyufans.com \
-p 443:443 -p 80:80 -p 22:22 \
--name gitlab \
--restart always \
--privileged=true \
-v /opt/gitlab/config:/etc/gitlab \
-v /opt/gitlab/logs:/var/log/gitlab \
-v /opt/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
```