ubuntu 快速安装 docker 、docker-compose 并搭建私有 gitlab 可公网访问

gitlab


一、docker 安装

1. 一条命令安装 docker

wget -qO- https://get.docker.com/ | sh

2. docker 免sudo (you-user:用户名)

If you would like to use Docker as a non-root user, you should now consider
adding your user to the “docker” group with something like:
bash sudo usermod -aG docker your-user

3. docker 镜像加速
新建或修改 /etc/docker/daemon.json ,加入以下内容:

sudo vim /etc/docker/daemon.json
{
  "registry-mirrors": ["http://hub-mirror.c.163.com"]
}

或直接使用以下命令:

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["http://hub-mirror.c.163.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

4. 阿里私有镜像加速器

点击此处 - - - 阿里容器ACR

进入链接 - - [侧边栏]镜像中心 - - [侧边栏]镜像加速器 - - 复制加速器地址

依照第3步将链接写入 daemon.json


二、docker-compose 安装

1. Run this command to download the current stable release of Docker Compose:

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

2. Apply executable permissions to the binary:

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

3. check docker-compose version:

sudo docker-compose version

三、使用 docker-compose 安装 gitlab

1. 编写 docker-compose.yml

sudo vim docker-compose.yml

写入以下内容:

version: '3'
services:
    gitlab:
      image: 'gitlab/gitlab-ce'
      restart: unless-stopped
      hostname: 'your host port'
      environment:
        TZ: 'Asia/Shanghai'
        GITLAB_OMNIBUS_CONFIG: |
          external_url 'http://your host port'
          gitlab_rails['time_zone'] = 'Asia/Shanghai'
          # 电子邮件的配置:
          # gitlab_rails['smtp_enable'] = true
          # gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
          # gitlab_rails['smtp_port'] = 465
          # gitlab_rails['smtp_user_name'] = "xxxx@xx.com"
          # gitlab_rails['smtp_password'] = "password"
          # gitlab_rails['smtp_authentication'] = "login"
          # gitlab_rails['smtp_enable_starttls_auto'] = true
          # gitlab_rails['smtp_tls'] = true
          # gitlab_rails['gitlab_email_from'] = 'xxxx@xx.com'
      ports:
        - '9999:9999'
          #- '443:443'
          #- '22:22'
      volumes:
        - /root/gitlab/config:/etc/gitlab
        - /root/gitlab/data:/var/opt/gitlab
        - /root/gitlab/logs:/var/log/gitlab

2. 在 docker-compose.yml 同目录创建映射文件夹

mkdir config
mkdir data
mkdir logs

3. 拉取镜像并启动

docker-compose up -d

启动成功即可访问

其他帮助

建议把第三个看看,内存问题,防患未然

Q:中文版 gitlab
A:https://www.jianshu.com/p/2d76092ebf53

Q:gitlab 数量项目限制
A:Use your admin account to login to GitLab and visit http://your_gitlab_host/admin/application_settings to change default_projects_limit value as you wish.

Q:解决GitLab内存消耗大的问题
A:https://blog.csdn.net/ouyang_peng/article/details/84066417

Q:linux gitlab-ctl reconfigure报错问题修复 502
A:https://www.cnblogs.com/shikyoh/p/10688340.html

Q:gitlab访问错误Whoops, GitLab is taking too much time to respond
A:https://blog.csdn.net/vtopqx/article/details/80883127

Q:ubuntu16.04 查看CPU是几核
A:https://www.cnblogs.com/soyo/p/7908365.html

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

泡泡码客

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值