Nov 18, 2023

GitLab on Docker for a M1 or M2 Mac

yrzr gitlab
ravermeister gitlab

Install Docker Desktop for your Silicon Mac, start it, and open Terminal to run the Docker Pull Command. Once you got the image added to Docker, use the Docker Dashboard to configure the image and run the container for the first time. For the Docker Pull Command click on one of the images above. For any unused image shown in the Dashboard, click the Run symbol in the Actions column to enter settings and generate a container from the image. 

docker-config-run


IMPORTANT: Make sure that Docker Desktop has grpcFuse set for file sharing (and not VirtioFS) - in Docker Preferences, General tab. Otherwise Postgres trouble.   Check the Volumes table below. Create folder lab4dev, and also the three folders config, data, logs inside it. Of course feel free to rename lab4dev.
Click “Run”, in the window that pops up fill in the data like so:

Container name

myGitLab Community Edition

Ports

Host port

Container port

22

22/tcp

443

443/tcp

80

80/tcp

Volumes

Host path

Container path

/Users/my_user_name/lab4dev/config


/Users/my_user_name/lab4dev/data


/Users/my_user_name/lab4dev/logs


/Users/my_user_name/lab4dev/config

/etc/gitlab

/Users/my_user_name/lab4dev/data

/var/opt/gitlab

/Users/my_user_name/lab4dev/logs

/var/log/gitlab

Environment variables

Variable

Value

GITLAB_OMNIBUS_CONFIG

external_url 'http://mySiliconMac.local'

GITLAB_ROOT_PASSWORD

strongPswd_atLeastEightCharacters


See your Mac’s “System Settings/Sharing” for your Mac’s local hostname. The root password really needs to be strong, “testing123” won’t work. Click the “Run” button, wait 5 minutes, enjoy your GitLab container. GitLab will be at localhost and on the local network at mySiliconMac.local

A fake SMTP server would catch and display the emails sent by GitLab. For example, smtp4dev can do this, and it can also relay emails to a real send mail server. Run docker pull rnwood/smtp4dev to pull its image from hub.docker.com , create folder smtp4dev_data , than run the image with the following options to make a container:

Container name

Smtp4dev

Ports

Host port

Container port

143

143/tcp

25

25/tcp

3000

80/tcp

Volumes

Host path

Container path

/users/my_user_name/lab4dev/smtp4dev_data


/users/my_user_name/lab4dev/smtp4dev_data

/smtp4dev

Environment variables 

Variable (there are 2 underscores in ServerOptions__HostName)

Value

ServerOptions__HostName

smtp4dev


Run the image with the typed in options. The container will be available at localhost:3000 and at mySiliconMac.local:3000
Note: Smtp4dev is also available on GitHub.

Just for fun, check the Docker network, and the containers on it, with Terminal:

    docker network ls
    docker network inspect bridge

The default Docker network is named bridge.

Edit /users/my_user_name/lab4dev/config/gitlab.rb with your preferred plain text editor, to configure the SMTP settings.
Add the following lines to the SMTP settings section:

### GitLab email server settings
###! Docs: https://docs.gitlab.com/omnibus/settings/smtp.html
###! **Use smtp instead of sendmail/postfix.**

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "mySiliconMac.local"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'none'
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_ssl'] = false
gitlab_rails['smtp_force_ssl'] = false

gitlab_rails['smtp_user_name'] = ""
gitlab_rails['smtp_password'] = ""
gitlab_rails['smtp_authentication'] = "login"




gitlab ctl-reconfig


GitLabCE: let the container run, execute in Docker Internal Terminal gitlab-ctl reconfigure to make the config happen. Smtp4dev: see the intercepted emails in the smtp4dev web interface - “allow remote connections” must be on.

Good luck and have fun!

gitlab-intel-mac

GitLab + Docker on Intel Mac

The official GitLabCE image on Docker Desktop for Mac. Works on Intel Mac. 

gitlab-ce-search

Full text search for GitLabCE

GitLab Search from GitHub. Enables full text search for GitLabCE.