What is GitLab
GitLab is an open source end-to-end software development platform with built-in version control, issue tracking, code review, CI/CD, and more. Self-host GitLab on your own servers, in a container, or on a cloud provider. -https://gitlab.com/gitlab-org/gitlab
Installing Docker
- Log into the Linux based device
- Run the following commands in the terminal
# install prerequisites
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y
# add docker gpg key
curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
# add docker software repository
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
# install docker
sudo apt install docker-ce docker-compose containerd.io -y
# enable and start docker service
sudo systemctl enable docker && sudo systemctl start docker
# add the current user to the docker group
sudo usermod -aG docker $USER
# reauthenticate for the new group membership to take effect
su - $USER
Running GitLab
- Now that Docker is installed, run the following commands to setup the GitLab Docker container and run it
# create working directory
sudo mkdir /home/$USER/docker/gitlab -p
# run the GitLab docker container
docker run --name gitlab -d --hostname DNSofHost -p 8000:80 -v /home/$USER/docker/gitlab/config:/etc/gitlab -v /home/$USER/docker/gitlab/logs:/var/log/gitlab -v /home/$USER/docker/gitlab/data:/var/opt/gitlab --restart=unless-stopped gitlab/gitlab-ce:latest
# output root user password
docker exec -it gitlab cat /etc/gitlab/initial_root_password - Copy the password to your clipboard
- Open a web browser and navigate to http://DNSorIP:8000
- Login with the username root and the password copied earlier
- Welcome to GitLab running in a Docker container
Documentation: https://hub.docker.com/r/gitlab/gitlab-ce/