Docker方式安装gitlab--ARM64平台安装详解
作者:OldXu-PPP
这篇文章主要介绍了Docker方式安装gitlab--ARM64平台安装,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
一、部署前提条件
机器配置要大于4g,否则很容易启动不了,报502
二、详细操作
2.1 拉取gitlab镜像
gitlab-ce表示的是社区免费版本
docker pull yrzr/gitlab-ce-arm64v8:latest #arm64平台
2.2 创建映射文件
mkdir -p /data/docker/gitlab/etc mkdir -p /data/docker/gitlab/log mkdir -p /data/docker/gitlab/data
2.3 启动gitlab
#arm64平台 sudo docker run \ --detach \ --restart always \ --name gitlab-ce \ --privileged=true \ --memory 4096M \ --publish 222:22 \ --publish 8088:80 \ --publish 4433:443 \ --env GITLAB_OMNIBUS_CONFIG=" \ nginx['redirect_http_to_https'] = true; "\ --volume /data/docker/gitlab/etc:/etc/gitlab:z \ --volume /data/docker/gitlab/log:/var/log/gitlab:z \ --volume /data/docker/gitlab/data:/var/opt/gitlab:z \ yrzr/gitlab-ce-arm64v8:latest
2.4 进入容器修改配置文件
让项目克隆地址显示为宿主机的ip和port
vi /etc/gitlab/gitlab.rb external_url 'http://172.16.0.55' #gitlab访问地址,可以写域名。如果端口不写的话默认为80端口 gitlab_rails['gitlab_ssh_host'] = '172.16.0.55' #ssh主机ip gitlab_rails['gitlab_shell_ssh_port'] = 222 #ssh连接端口 #重新加载配置文件 gitlab-ctl reconfigure
注意不要重启,/etc/gitlab/gitlab.rb文件的配置会映射到gitlab.yml这个文件,由于在docker中运行,在gitlab上生成的http地址应该是http://172.16.0.55:8088,所以,要修改下面文件
vi /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml #将端口号80修改为8088,让项目克隆的http地址显示正确
## GitLab settings gitlab: ## Web server settings (note: host is the FQDN, do not include http://) host: 172.16.0.55 port: 8088 https: false
#重启服务
gitlab-ctl restart
2.5 查看root登录密码
访问 http://172.16.0.55:8088/users/sign_in
root@1eb2343359d2:/# cat /etc/gitlab/initial_root_password # WARNING: This value is valid only in the following conditions # 1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run). # 2. Password hasn't been changed manually, either via UI or via command line. # # If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password. Password: FZpGKk3WVhodQ4uhKrvVHEPbQ9SDVWFj+pRJcAMA0YI= # NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
2.6 可选操作,修改root密码
sudo docker exec -it gitlab-ce bash gitlab-rails console -e production user = User.where(id:1).first #查询id为1的用户,id为1的用户是超级管理员 user.password='qwer4567' #修改密码为qwer4567 user.save! #保存
2.7 登录web并设置中文
preferences-->Localization--->language-->简体中文
记录时间:2023-10-09
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。