docker搭建gitlab私有库

创建挂载目录

mkdir /mydata/gitlab-ce/config
mkdir /mydata/gitlab-ce/data
mkdir /mydata/gitlab-ce/logs

文件赋权

chmod 777 -R /mydata/gitlab-ce

docker-compose安装

安装python3

yum -y install epel-release
yum -y install python3-pip
pip3 --version

修改pip源

mkdir /root/.pip
vi /root/.pip/pip.conf
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com

安装依赖

pip3 install setuptools-rust
pip3 install --upgrade pip
python3 --version
pip3 install docker-compose
docker-compose version

创建docker-compose.yml

version: '2'
services:
    gitlab:
      container_name: "gitlab"
      image: 'docker.io/gitlab/gitlab-ce:14.4.5-ce.0'
      restart: always
      hostname: '192.168.56.10'
      privileged: true
      environment:
        TZ: 'Asia/Shanghai'
        GITLAB_OMNIBUS_CONFIG: |
          external_url 'http://192.168.56.10:3080'
          gitlab_rails['time_zone'] = 'Asia/Shanghai'
          gitlab_rails['gitlab_shell_ssh_port'] = 3022
          #gitlab_rails['gitlab_ssh_host'] = 'www.gitlab.htyzlc.com'
      ports:
        - '3080:3080'
        - '3443:443'
        - '3022:22'
      volumes:
        - /mydata/gitlab-ce/config:/etc/gitlab
        - /mydata/gitlab-ce/data:/var/opt/gitlab
        - /mydata/gitlab-ce/logs:/var/log/gitlab
      #shm_size: '1024m'

创建并启动容器

docker-compose up -d

查看密码

 cat /mydata/gitlab-ce/config/initial_root_password

你可能感兴趣的:(Git,Linux,#,Docker,docker,gitlab,容器)