使用docker-compose部署gitlab服务
前提条件:确保服务器都安装了docker以及docker-compose服务
🔑 创建docker-compose.yml
# 创建存放位置 mkdir -p /data/gitlab && cd /data/gitlab touch docker-compose.yml # external_url处请更换为您服务器的IP或域名。 cat > docker-compose.yml << EOF version: '3.6' services: gitlab: image: 'gitlab/gitlab-ce:latest' container_name: gitlab restart: always environment: GITLAB_OMNIBUS_CONFIG: | external_url 'http://172.31.2.212:8929' gitlab_rails['gitlab_shell_ssh_port'] = 2224 ports: - '8929:8929' - '2224:22' volumes: - '/data/gitlab/config:/etc/gitlab' - '/data/gitlab/logs:/var/log/gitlab' - '/data/gitlab/data:/var/opt/gitlab' shm_size: '256m' EOF
🧲 本地创建挂载目录
# 在/data/gitlab目录下创建 cd /data/gitlab mkdir config logs data
💼 运行docker-compose
# 在docker-compose.yml文件目录中运行 [root@gitlab gitlab]# docker-compose up -d [+] Building 0.0s (0/0) [+] Running 2/2 ✔ Network gitlab_default Created ✔ Container gitlab Started # 查看容器运行日志 # 创建时间可能较长,耐性等待 docker-compose logs -f
🔭 浏览器访问Gitlab首页
- 浏览器输入: http://172.31.2.212:8929
- 获取root用户初始密码
[root@gitlab gitlab]# docker exec -it gitlab 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: M4UXhVZe4VmGfVpmcrdQBk15MTf1iDrViwhWoxIMn8A= # NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
-
修改密码
-
修改默认语言
修改后刷新浏览器页生效
本文作者:Ronnybox
本文链接:https://www.cnblogs.com/ronnybox/p/17534937.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步