Skip to content

gitlab-ce-docker Plugin

This plugin installs GitLab CE(Community Edition) on Docker.

NOTICE: currently, this plugin support Linux only.


GitLab officially provides an image gitlab-ce. We can use this image to start a container:

docker run --detach \
  --hostname \
  --publish 443:443 --publish 80:80 --publish 22:22 \
  --name gitlab \
  --restart always \
  --volume $GITLAB_HOME/config:/etc/gitlab \
  --volume $GITLAB_HOME/logs:/var/log/gitlab \
  --volume $GITLAB_HOME/data:/var/opt/gitlab \
  --shm-size 256m \

The variable $GITLAB_HOME here pointing to the directory where the configuration, logs, and data files will reside.

We can set this variable by the export command:

export GITLAB_HOME=/srv/gitlab

The GitLab container uses host mounted volumes to store persistent data:

Local location Container location Usage
$GITLAB_HOME/data /var/opt/gitlab For storing application data
$GITLAB_HOME/logs /var/log/gitlab For storing logs
$GITLAB_HOME/config /etc/gitlab For storing the GitLab configuration files

So, we can customize the following configurations:

  1. hostname
  2. host port
  3. persistent data path
  4. docker image tag


Note: 1. the user you are using must be root or in the docker group; 2. https isn't supported for now.

The following content is an example of the "tool file".

For more information on the main config, the tool file and the var file of DevStream, see Core Concepts Overview and DevStream Configuration.

# name of the tool
- name: gitlab-ce-docker
  # id of the tool instance
  instanceID: default
  # format: name.instanceID; If specified, dtm will make sure the dependency is applied first before handling this tool.
  dependsOn: [ ]
  # options for the plugin
    # hostname for running docker. (default:
    # pointing to the directory where the configuration, logs, and data files will reside.
    # (default: /srv/gitlab)
    # 1. it should be a absolute path
    # 2. once the tool is installed, it can't be changed
    gitlabHome: /srv/gitlab
    # ssh port exposed in the host machine. (default: 22)
    sshPort: 22
    # http port exposed in the host machine. (default: 80)
    httpPort: 80
    # https port exposed in the host machine.
    # (default: 443)
    # todo: support https, reference:
    httpsPort: 443
    # whether to delete the gitlabHome directory when the tool is removed. (default: false)
    rmDataAfterDelete: false
    # gitlab-ce tag. (default: "rc")
    imageTag: "rc"

Some Commands That May Help

  • clone code
export hostname=YOUR_HOSTNAME
export username=YOUR_USERNAME
export project=YOUR_PROJECT_NAME
  1. ssh
# port is 22
git clone git@${hostname}/${username}/${project}.git
# port is not 22, 2022 as a sample
git clone ssh://git@${hostname}:2022/${username}/${project}.git
  1. http
# port is 80
git clone http://${hostname}/${username}/${project}.git
# port is not 80, 8080 as a sample
git clone http://${hostname}:8080/${username}/${project}.git