docker安装gitlab

参考文献:https://blog.csdn.net/u011054333/article/details/61532271

1、 下载gitlab镜像:gitlab/gitlab-ce:latest

2、 创建挂载目录:

 

3、 先干跑一下镜像,然后将容器的目录拷贝到新建的目录内,然后赋予权限777,不然会报错。

4、 编写compose文件

version: "3"

services:

  gitlab:

    image: gitlab/gitlab-ce

    ports:

    - "8880:80"

    volumes:

    - "./etc/gitlab:/etc/gitlab"

    - "./log/gitlab:/var/log/gitlab"

    - "./opt/gitlab:/var/opt/gitlab"

    - "/etc/localtime:/etc/localtime:ro"

    environment:

    - TZ=Asia/Shanghai

restart: always

5、 docker-compose up -d运行即可

6、如何关闭注册功能:

 7、备份与恢复:

参考文献:https://www.cnblogs.com/root0/p/9268866.html

#!/bin/bash

container=`docker ps | grep gitlab-ce | awk '{print $1}'`
backup_src=/data/compose/gitlab/opt/gitlab/backups
backup_dst=/data/backups/gitlab

# This is a backup scripts
#docker exec ${container} gitlab-rake gitlab:backup:create
#mv ${backup_src}/* ${backup_dst}

# This is a restore scripts
# Backup follow a backup tag, not a file name
backup_tag=$1

# cp ${backup_dst}/${backup_tag}_gitlab_backup.tar ${backup_src}
echo -e 'yes ' | docker exec ${container} gitlab-rake gitlab:backup:restore BACKUP=${backup_tag}

 8、配置url:

 

 

 然后重启容器即可。

原文地址:https://www.cnblogs.com/caibao666/p/11559017.html