Introduction
Prerequisites
-
An Ubuntu 22.04 server. -
Sufficient system resources, including disk space, RAM, and CPU, to run GitLab CE and Docker containers.
-
GitLab CE: Set aside 10-20 GB of disk space for GitLab’s application data and repositories. This area may vary depending on the number and size of projects you intend to host.
-
Docker: Make sure you have enough disk space for Docker images and containers. Aim for at least 20 GB of free space for Docker.
-
GitLab CE: For optimal performance, allocate at least 4 GB of RAM. However, if you anticipate heavy usage or a large number of concurrent users, consider allocating more RAM to efficiently handle the load.
-
Docker itself does not require a lot of memory. However, it is recommended that you have at least 2 GB of RAM available for Docker to run smoothly. Keep in mind that the more containers you run at the same time, the more memory you may require.
-
GitLab CE requires a multi-core CPU with a clock speed of at least 2 GHz. The number of CPU cores required is determined by the anticipated load and the number of concurrent users. GitLab can handle concurrent requests more efficiently because it has multiple cores.
-
Docker is designed to make efficient use of available CPU resources. A CPU with multiple cores or threads is advantageous, especially if you intend to run resource-intensive containers or have a large number of containers running concurrently.
Step 1: Update the package index
sudo apt update sudo apt upgrade -y
Step 2: Install Docker on Ubuntu 22.04
sudo apt install apt-transport-https ca-certificates curl software-properties-common
sudo nano /etc/ssh/sshd_config
sudo service ssh restart
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io
sudo docker run hello-world

Step 3: Install GitLab CE with Docker:
sudo docker pull gitlab/gitlab-ce:latest

sudo mkdir -p /srv/gitlab/config /srv/gitlab/logs /srv/gitlab/data
sudo docker run --detach \ --hostname YOUR_SERVER_IP \ --publish 443:443 --publish 80:80 --publish 22:22 \ --name gitlab \ --restart always \ --volume /srv/gitlab/config:/etc/gitlab \ --volume /srv/gitlab/logs:/var/log/gitlab \ --volume /srv/gitlab/data:/var/opt/gitlab \ gitlab/gitlab-ce:latest

Step 4: Configure GitLab CE with Docker
-
Run the following command to access the GitLab container’s shell:
sudo docker exec -it gitlab /bin/bash
-
Once inside the container’s shell, run the following command to reset the root user’s password:
gitlab-rake "gitlab:password:reset"
-
You’ll be asked to enter the username for which you’d like to reset the password. Enter root as the username and hit the Enter key.
-
Following that, you should receive confirmation that the password reset was successful.
-
Enter exit and press Enter to exit the container’s shell.

-
Restart the Docker
sudo systemctl restart docker
Step 5: Creating Your First Project



