Also refer to the GitLab Documentation
docker volume create gitlab-data
docker volume create gitlab-logs
docker volume create gitlab-config
Refer to Docker Hub for the available versions
Prepare the following environment variables:
Environment Variable | Content | Example |
---|---|---|
GITLAB_HOSTNAME |
Hostname | export GITLAB_HOSTNAME="192.168.2.6" |
GITLAB_SECURE_PORT |
HTTPS Port | export GITLAB_SECURE_PORT=7443 |
GITLAB_INSECURE_PORT |
HTTP Port | export GITLAB_INSECURE_PORT=7080 |
GITLAB_SSH_PORT |
SSH Port | export GITLAB_SSH_PORT=7022 |
GITLAB_VERSION |
The version | export GITLAB_VERSION="14.10.0-ce.0" |
GITLAB_RESTART_POLICY |
The restart policy | export GITLAB_RESTART_POLICY="unless-stopped" |
And then start GitLab with the following command:
docker run --detach \
--hostname $GITLAB_HOSTNAME \
--publish $GITLAB_SECURE_PORT:443 --publish $GITLAB_INSECURE_PORT:80 --publish $GITLAB_SSH_PORT:22 \
--name gitlab \
--restart $GITLAB_RESTART_POLICY \
--mount source=gitlab-config,target=/etc/gitlab \
--mount source=gitlab-logs,target=/var/log/gitlab \
--mount source=gitlab-data,target=/var/opt/gitlab \
--shm-size 256m \
gitlab/gitlab-ce:$GITLAB_VERSION
Note: The first run can take a minute or two for setup to complete.
Run the following:
docker exec -it gitlab cat /etc/gitlab/initial_root_password
Typically the following tasks should be performed post installation:
- Set the root password
- Disable user self-registration (unless you want users to self-register)
- Create a normal user for you
- Load your SSH public key