一、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. 阿里私有镜像加速器
进入链接
- - [侧边栏]镜像中心
- - [侧边栏]镜像加速器
- - 复制加速器地址
依照第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