Video coming soon…

🦊 Setup GitLab CE — Self-Hosted Git & CI/CD

Deploy GitLab Community Edition on Ubuntu with Docker — the complete DevOps platform with Git repositories, CI/CD pipelines, container registry, issue tracking, and merge requests, all on your own server.

⚠️ This script is provided for demo and testing purposes only. Not intended for production use.

📦 Resources & Setup Scripts

Grab the automated bash script from GitHub to follow along with the video.

Automated install script — GitLab CE with CI/CD running in one command.
View on GitHub

Quick Install:

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/devops/gitlab/gitlab-ubuntu.sh
chmod +x gitlab-ubuntu.sh
sudo bash gitlab-ubuntu.sh

Tutorial Steps

1 Download & Run the Script

The script installs Docker and starts GitLab CE. GitLab takes 3-5 minutes to fully initialize on first start. The web UI will be available on port 80. Note: GitLab requires at least 4 GB RAM — check available memory before starting.

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/devops/gitlab/gitlab-ubuntu.sh
chmod +x gitlab-ubuntu.sh
sudo bash gitlab-ubuntu.sh

2 Access the Web UI & Set Root Password

GitLab generates a temporary root password on first start. Retrieve it and log in to set a permanent password. Navigate to your GitLab instance and sign in as root:

# Get the temporary root password
docker exec gitlab cat /etc/gitlab/initial_root_password

# Access GitLab in browser
http://<your-server-ip>

3 Create a Project & Push Your First Code

Click New Project → Create blank project. Give it a name, set visibility (private/public/internal), and initialize with a README. Clone the repository locally and push your code. GitLab generates SSH and HTTPS clone URLs for each project:

git clone http://<your-server-ip>/your-username/your-project.git
cd your-project
echo "# My Project" > README.md
git add . && git commit -m "Initial commit"
git push origin main

4 Configure a CI/CD Pipeline

Create a .gitlab-ci.yml file in your repository root to define your CI/CD pipeline. GitLab automatically detects this file and runs the pipeline on every push. Add a GitLab Runner to execute jobs — go to Settings → CI/CD → Runners to get the registration token:

# Example .gitlab-ci.yml
stages:
  - test
  - build

test:
  stage: test
  image: node:20
  script:
    - npm install
    - npm test

build:
  stage: build
  script:
    - docker build -t my-app .

Ports Used

PortPurpose
80GitLab Web UI (HTTP)
443GitLab Web UI (HTTPS)
22SSH Git clone / push
5050Container Registry (optional)

Overview

GitLab CE (Community Edition) is a complete, free, open-source DevOps platform that combines Git repository hosting, CI/CD pipelines, a container registry, issue tracking, project wikis, and merge request workflows in one self-hosted application. Unlike GitHub, GitLab stores all your code and CI/CD data on your own server with zero dependency on third-party cloud services. The built-in CI/CD system (defined in .gitlab-ci.yml) lets you automate testing, building Docker images, security scanning, and deployments — all running on GitLab Runners you control.

Why Use It

GitLab CE gives development teams the complete DevOps toolchain on a single self-hosted server. Code, pipelines, container images, and project management all live in one place. There are no per-user fees, no CI/CD minute limits (you run your own runners), and no data leaves your infrastructure. For companies with compliance requirements or air-gapped environments, GitLab CE provides the full GitHub/GitHub Actions experience without cloud dependency.

When You Need It

    Who Should Use It

      Real Use Cases

        Main Features

          How to Use After Installation

            Security Best Practices

              Ports and Firewall Notes

              Open port 80 (HTTP) and 443 (HTTPS) for the web interface. Port 22 (SSH) must be open for git clone/push via SSH — or configure GitLab to use a non-standard SSH port. Port 5050 is optional for the container registry. In production, put GitLab behind a reverse proxy and redirect port 80 to 443.

              Backup and Maintenance

                Common Mistakes

                  Troubleshooting

                    Alternatives

                    Gitea is a lightweight Go-based Git server with much lower RAM requirements (128 MB vs 4 GB). Woodpecker CI provides CI/CD for Gitea-based workflows. GitHub is the dominant hosted Git platform. Bitbucket (Atlassian) offers on-premise deployment. For teams that only need Git hosting without CI/CD, Gitea is a better fit. GitLab shines when you need the full DevOps platform in one install.

                    When Not to Use It

                    Avoid GitLab CE on servers with less than 4 GB RAM — the memory usage is substantial. For small teams (1-5 developers) who just need Git hosting, Gitea is far more lightweight and easier to run. Don't use GitLab if your team is already comfortable with GitHub Actions and doesn't need data sovereignty — the hosted GitHub is significantly more polished for individual developer experience.

                    PrismaTechWork Professional Help

                    PrismaTechWork provides end-to-end infrastructure services — from initial deployment and security hardening to ongoing monitoring, automated backups, and dedicated support. Whether you need a single-server setup or a multi-site network, our team ensures your infrastructure is built right, secured properly, and maintained reliably.

                      Contact Us

                      Frequently Asked Questions

                      What is GitLab CE and how does it differ from GitHub?

                      GitLab CE (Community Edition) is a free, open-source self-hosted DevOps platform that combines Git repository hosting, CI/CD pipelines, container registry, issue tracking, wikis, and merge request workflows in one application. Unlike GitHub, GitLab is self-hosted — your code never leaves your server. GitLab CE includes built-in CI/CD (via .gitlab-ci.yml) which GitHub requires separate Actions for. GitLab also has a built-in container registry and package registry in the CE version.

                      What are GitLab CI/CD pipelines and how do they work?

                      GitLab CI/CD pipelines are automated workflows defined in a .gitlab-ci.yml file at the root of your repository. When you push code, GitLab automatically runs the pipeline — which can include stages for testing, building Docker images, security scanning, and deployment. Each stage runs in a GitLab Runner (a lightweight agent). Pipelines are visualized in the GitLab UI with logs, pass/fail status, and timing for each job.

                      What are the server requirements for GitLab CE?

                      GitLab CE requires at minimum 4 GB RAM (8 GB recommended for comfortable use) and 2 vCPUs. GitLab is the most resource-heavy self-hosted Git platform — it runs Ruby on Rails, Sidekiq workers, Gitaly (Git storage), and PostgreSQL. For a team of up to 10 users, a 4 vCPU / 8 GB VPS is sufficient. For 50+ users, 8 vCPUs / 16 GB RAM or more is recommended.

                      What is a GitLab Runner and how do I register one?

                      A GitLab Runner is a lightweight agent that picks up CI/CD jobs from GitLab and executes them. The Docker executor runs each job inside a fresh Docker container. To register a runner: install gitlab-runner on a server, then run gitlab-runner register and provide your GitLab URL and a registration token from Settings → CI/CD → Runners. Runners can be shared (available to all projects) or project-specific.

                      Does GitLab CE include a container registry?

                      Yes. GitLab CE includes a built-in container registry accessible at registry.yourdomain.com. You can push and pull Docker images using standard docker login and docker push commands. Images are stored on your server. The registry is automatically integrated with CI/CD — pipelines can push images to the registry using the $CI_REGISTRY predefined variables without any manual configuration.

                      Can I migrate from GitHub or Gitea to GitLab?

                      Yes. GitLab provides a built-in import tool that can import projects from GitHub, Bitbucket, Gitea, and other Git hosts. Go to New Project → Import Project → choose your source. The importer migrates repositories, issues, merge/pull requests, milestones, and labels. For GitHub, use a personal access token to authenticate. Large repositories and many issues may take time to import.

                      How do I set up HTTPS for self-hosted GitLab?

                      For Docker deployment, use a reverse proxy like Nginx Proxy Manager or Caddy in front of GitLab. Set the GITLAB_OMNIBUS_CONFIG environment variable with external_url pointing to your HTTPS domain. The reverse proxy handles TLS termination and forwards traffic to GitLab's internal port. Update the GitLab config with the correct external URL so clone URLs and webhooks use HTTPS.

                      Is GitLab CE really free or are features locked behind Enterprise?

                      GitLab CE is genuinely free with no feature time limits. It includes Git hosting, CI/CD pipelines (unlimited minutes when self-hosted), container registry, issue tracking, merge requests, wikis, LDAP integration, and much more. GitLab EE (Enterprise Edition) adds advanced features like epics, portfolio management, security scanning dashboards, and enterprise SSO. For most teams, CE provides everything needed.