Skip to content

Instantly share code, notes, and snippets.

@kxxoling
Created August 12, 2016 07:53
Show Gist options
  • Save kxxoling/dfa6659829934edc296a406e52f2d585 to your computer and use it in GitHub Desktop.
Save kxxoling/dfa6659829934edc296a406e52f2d585 to your computer and use it in GitHub Desktop.
使用 docker 安装 GitLab CE 和 GitLab CI

使用 docker 安装 GitLab CE 和 GitLab CI

安装 gitlab-ce:

docker run -p 8030:80 -d --name gitlab-ce\
    -v $HOME/app-conf/gitlab/etc:/etc/gitlab \
    -v $HOME/app-conf/gitlab/var/opt:/var/opt/gitlab \
    -v $HOME/app-conf/gitlab/log:/var/log/gitlab \
    gitlab/gitlab-ce

稍等片刻,等待 gitlab-ce 初始化完成。如果 curl http://127.0.0.1:8030/ 返回了 HTML 内容则说明初始化完成。

安装 gitlab-runner

docker run -d --name gitlab-runner \
    --link gitlab-ce:gitlab-ce \
    --restart always \
    -v $HOME/app-conf/gitlab-runner/config:/srv/gitlab-runner/config \
    gitlab/gitlab-runner:latest

注册 gitlab-runner:

docker exec -it gitlab-runner gitlab-runner register

交互:

Running in system-mode.

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/ci):
http://gitlab-ce/ci
Please enter the gitlab-ci token for this runner:
y67oVqdTRf1QMSR9aWE8
Please enter the gitlab-ci description for this runner:
[b34e8ce72aaf]: test
Please enter the gitlab-ci tags for this runner (comma separated):
test
Registering runner... succeeded                     runner=y67oVqdT
Please enter the executor: docker, docker-ssh, parallels, shell, ssh, virtualbox, docker+machine, docker-ssh+machine:
shell
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment