# 创建交换虚拟内存(如果服务器比较差劲,服务器牛X的就忽略这一步)
sudo dd if=/dev/zero of=/d4peng/swap bs=1M count=1024
sudo mkswap /d4peng/swap
sudo swapon /d4peng/swap
sudo echo '/d4peng/swap swap swap defaults 0 0' >> /etc/fstab
# gitlab挂载目录
gitlabdir='/d4peng/docker/gitlab'
mkdir -p $gitlabdir
chmod -R 777 $gitlabdir
# 创建gitlab容器镜像
docker run --detach --publish 443:443 --publish 80:80 --publish 23:22 --name gitlab --restart always -v $gitlabdir/etc:/etc/gitlab -v $gitlabdir/logs:/var/log/gitlab -v $gitlabdir/data:/var/opt/gitlab --privileged=true gitlab/gitlab-ce
# 修改配置
sudo cat << EOF >> $gitlabdir/etc/gitlab.rb
external_url 'http://192.168.0.103'
gitlab_rails['gitlab_ssh_host'] = '192.168.0.103'
gitlab_rails['gitlab_shell_ssh_port'] = 23
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "977891526@qq.com"
gitlab_rails['smtp_password'] = "glktygzrqgaxbbee"
gitlab_rails['smtp_domain'] = "smtp.qq.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = '977891526@qq.com'
EOF
# 重启Gitlab
docker exec -it gitlab /bin/bash
gitlab-ctl reconfigure
exit
网友评论