Skip to content

Instantly share code, notes, and snippets.

@joeke80215
Created July 22, 2018 01:56
Show Gist options
  • Save joeke80215/588f81b4e24e146ec969639dba68261d to your computer and use it in GitHub Desktop.
Save joeke80215/588f81b4e24e146ec969639dba68261d to your computer and use it in GitHub Desktop.

Deploy gitlab-ce by docker

create service

docker run --detach \
    --hostname gitlab.example.com \
    --publish 8443:443 \
    --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

modify /srv/gitlab/config/gitlab.rb

external_url 'https://gitlab.example.com:443'

///add
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/etc/gitlab/ssl/service.crt(or service.pem)"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/service.key"

Add certification(service.pem,service.key) to "/srv/gitlab/config/ssl/"

reconfig gitlab service

docker exec -it gitlab gitlab-ctl reconfigure

docker-compose.yaml

gitlab-docker-compose:
  image: 'gitlab/gitlab-ce:latest'
  restart: always
  hostname: 'gitlab.example.com'
  environment:
    GITLAB_OMNIBUS_CONFIG: |
      external_url 'https://gitlab.example.com:8443'
      # Add any other gitlab.rb configuration here, each on its own line
  ports:
    - '8443:443'
  volumes:
    - '/srv/gitlab/config:/etc/gitlab'
    - '/srv/gitlab/logs:/var/log/gitlab'
    - '/srv/gitlab/data:/var/opt/gitlab'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment