2023 docker install gitlab-ce

The company builds a private server git to manage the code. Here, docker is used to install gitlab, and the process is relatively simple. The server needs to have at least 4GB of RAM. The gitlab-ce community edition installed here. The premise is that docker is installed

Install gitlab-ce

  • Download mirror, waiting for download...
    docker pull gitlab/gitlab-ce:latest
  • Created a directory /opt/docker/gitlabto save the data in the gitlab container
    # 创建一个用于存放gitlab数据的目录
    mkdir -p /opt/docker/gitlab
    # 进入到创建的目录下
    cd /opt/docker/gitlab
	 # 新建一个docker-compose.yml文件
    vim docker-compose.yml
  • The above has been newly created docker-compose.yml, write the docker-compose content, copy the following content in, pay attention to the format of spaces and the like
     version: '3.6'
     services:
       web:
         image: 'gitlab/gitlab-ce:latest'
         restart: always
         container_name: 'gitlab'
         hostname: 'gitlab'
         environment:
           GITLAB_OMNIBUS_CONFIG: |
             external_url 'http://192.168.5.216:8929'
             gitlab_rails['gitlab_shell_ssh_port'] = 2224
         ports:
           - '8929:8929'
           - '2224:22'
         volumes:
           - '$GITLAB_HOME/config:/etc/gitlab'
           - '$GITLAB_HOME/logs:/var/log/gitlab'
           - '$GITLAB_HOME/data:/var/opt/gitlab'
         shm_size: '256m'
    

Note that the ip address behind the external_url needs to be changed to the intranet ip of your own server, save and exit after completion.
insert image description here

  • run gitlab
      # 将下面的地址改成你存放gitlab持久化数据的地址,比如我的地址为/opt/docker/gitlab
      export GITLAB_HOME=/opt/docker/gitlab
      docker-compose up -d
    

insert image description here

  • Release two ports 8929 and 2224
firewall-cmd --add-port={8929,2224}/tcp --permanent
firewall-cmd --reload
  • Check the running status of gitlab, and use the ctrl + c key combination to exit.
    docker logs -f gitlab
    insert image description here
  • Check the initial password, copy and save the password, you need to log in and change the password later
    docker exec -it gitlab cat /etc/gitlab/initial_root_password
    insert image description here

configuration system

  • Access http:ip:8929 in the browser, replace ip with your server's ip address
  • log in system
    insert image description here
  • Close the registration function
    insert image description hereinsert image description here
    insert image description here
  • To modify the password of the root user, click on the personal icon preferences, and then find thepassword
    insert image description here
    insert image description here
  • After modification, you will log in again, and the installation is complete
    insert image description here

Guess you like

Origin blog.csdn.net/qq_31424825/article/details/128557992