美文网首页
Centos7安装docker-ce+gitlab-ce

Centos7安装docker-ce+gitlab-ce

作者: cnwinds | 来源:发表于2022-03-14 15:58 被阅读0次

1、安装docker-ce

wget -P /etc/yum.repos.d/ https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce

2、设置镜像加速器

vi /etc/docker/daemon.json
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://frelmnjd.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker

3、安装docker-compose 国内镜像源

sudo curl -L "https://get.daocloud.io/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

4、安装gitlab-ce

docker pull gitlab/gitlab-ce:14.7.5-ce.0

5、设置gitlab配置
gitlab-compose.yml

version: '3'
services:
  gitlab:
    image: 'gitlab/gitlab-ce:14.7.5-ce.0'
    hostname: 'code.iwgame.com'
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - './iwgame.com.crt:/etc/gitlab/ssl/lab.com.crt:ro'
      - './iwgame.com.key:/etc/gitlab/ssl/lab.com.key:ro'
      - '/data/gitlab/logs:/var/log/gitlab'
      - '/data/gitlab/data:/var/opt/gitlab'
      - '/data/gitlab/backups:/var/opt/gitlab/backups'
      - '/usr/share/zoneinfo/Asia/Shanghai:/etc/localtime'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'https://code.iwgame.com'
        nginx['enable'] = true
        nginx['client_max_body_size'] = '250m'
        nginx['redirect_http_to_https'] = true
        nginx['redirect_http_to_https_port'] = 80
        nginx['ssl_certificate'] = "/etc/gitlab/ssl/lab.com.crt"
        nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/lab.com.key"
        nginx['ssl_ciphers'] = "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256"
        nginx['ssl_prefer_server_ciphers'] = "on"
        nginx['ssl_protocols'] = "TLSv1.2"
        nginx['http2_enabled'] = true
        nginx['proxy_set_headers'] = {
          "X-Forwarded-Proto" => "http"
        }

6、启动gitlab

docker-compose -f gitlab-compose.yml up -d

7、查看gitlab root密码
docker ps 得到容器的<CONTAINER ID>
docker exec -it <CONTAINER ID> grep 'Password:' /etc/gitlab/initial_root_password 得到root的密码

相关文章

网友评论

      本文标题:Centos7安装docker-ce+gitlab-ce

      本文链接:https://www.haomeiwen.com/subject/sqojdrtx.html