docker deploys gitlab server

1. Pull the git image

docker pull gitlab/gitlab-ce:latest

2. Create a directory

GitLab's configuration (etc), log (log), and data (data) are usually placed outside the container to facilitate future upgrades, so please prepare these three directories first (I created them here under the ordinary user directory, not root)

mkdir -p /opt/gitlab/config
mkdir -p /opt/gitlab/logs
mkdir -p /opt/gitlab/data

3. Create a container

docker run --detach \
  --hostname 10.121.118.15 \
  --publish 8443:443 --publish 8880:8880 \
  --name gitlab \
  --volume ~/opt/gitlab/config:/etc/gitlab \
  --volume ~/opt/gitlab/logs:/var/log/gitlab \
  --volume ~/opt/gitlab/data:/var/opt/gitlab \
  --volume ~/etc/hosts:/etc/hosts \
  gitlab/gitlab-ce:latest

#hostname 10.121.118.15: 设置主机名或域名或IP
#publish 8443:443:将http:443映射到外部端口8443
#publish 8880:8880:将web:8880映射到外部端口8880
#name gitlab: 运行容器名
#volume 将容器目录挂载到宿主机

4. Browser access: http:host ip:8880, the access is successful.

Insert image description here

The newly installed gitlab will hide the initial password of root in a file. You can enter the container and execute the following command to view it. (You can also find the initial_root_password file in the host mount file)

docker exec -it gitlab bash
cat /etc/gitlab/initial_root_password

Insert image description here

6. Log in using root and its initial password, and change the password.

Insert image description here
Insert image description here
At this point, you can use Gitlab services to your heart's content.

Guess you like

Origin blog.csdn.net/weixin_49319422/article/details/128483872