【原创笔记】CICD系列之一:安装gitlab

CICD系列之一:安装gitlab

准备主机:10.0.0.14

1. 关闭防火墙和SELINUX

systemctl stop firewalld

systemctl disable firewalld

sed -i 's/enforcing/disabled/' /etc/selinux/config

setenforce 0

2. 安装docker

3. 安装docker-compose

下载适合你当前linux版本的docker-compose组件

sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

增加执行权限

sudo chmod +x /usr/local/bin/docker-compose

查看docker-compose版本

docker-compose --version

4. 搭建gitlab 私有仓库(使用内建的postgresql和redis)

mkdir -p /home/disk1/gitlab
mkdir -p /home/disk1/gitlab/{config,data,logs}
cd /home/disk1/gitlab && vi docker-compose.yml


version: '3'
services:

gitlab:
  container_name: gitlab
  image: 'twang2218/gitlab-ce-zh:11.1.4'
  restart: unless-stopped
  hostname: 'dev-poc'
  environment:
    TZ: 'Asia/Shanghai'
    GITLAB_OMNIBUS_CONFIG: |
      external_url 'http://dev-poc:10101'
      gitlab_rails['time_zone'] = 'Asia/Shanghai'
      gitlab_rails['gitlab_shell_ssh_port'] = 22
  ports:
    - '10101:10101'
    - '443:443'
    - '2222:22'
  volumes:
    - ./config:/etc/gitlab
    - ./data:/var/opt/gitlab
    - ./logs:/var/log/gitlab
        
    

5. 本地域名

echo "10.0.0.14 dev-poc" >> /etc/hosts

6. 启动

docker-compose up -d
docker-compose ps

7. 访问http://10.0.0.14:10101并更改root用户密码

你可能感兴趣的:(容器dockerdevops)