Here is the official document. I followed it.
Caution: I’m using my GitLab on VM, not Docker image. Because the official image doesn’t contain e-mail client, and it is a little bit hard to understand. For me, deploying it on premise or VM is easy.
apt install -y docker.io
export GITLAB_HOME=/srv/gitlab
Configurations and repositories would be stored in this path.
sudo docker run --detach \
--hostname {{ your_hostname }} \
--publish 443:443 --publish 80:80 --publish 2222:22 \
--name gitlab \
--restart always \
--volume $GITLAB_HOME/config:/etc/gitlab \
--volume $GITLAB_HOME/logs:/var/log/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
I changed git port to 2222 because the server should be access by ssh.
I want to run the container automatically when its boot time.
systemctl enable docker
Write /etc/systemd/system/gitlab.service
as below.
[Unit]
Description=GitLab docker
Requires=docker.service
After=docker.service
[Service]
Restart=always
ExecStart=/usr/bin/docker start -a gitlab
ExecStop=/usr/bin/docker stop -t 2 gitlab
[Install]
WantedBy=default.target
systemctl enable gitlab