Sunday, August 23, 2015

Docker Gitlab

1) Create the following file
vim run_gitlab.sh

CONTAINER_NAME="gitlab_server"
GITLAB_DATA_DIR="`pwd`/gitlab/"
GITLAB_SSH_PORT="2222"
GITLAB_HTTP_PORT="8080"
GITLAB_HTTPS_PORT="8443"

docker rm ${CONTAINER_NAME}
sudo docker run --detach \
    --publish ${GITLAB_HTTPS_PORT}:443 \
    --publish ${GITLAB_HTTP_PORT}:8000 \
    --publish ${GITLAB_SSH_PORT}:22 \
    --name ${CONTAINER_NAME} \
    --restart always \
    --volume ${GITLAB_DATA_DIR}config:/etc/gitlab \
    --volume ${GITLAB_DATA_DIR}logs:/var/log/gitlab \
    --volume ${GITLAB_DATA_DIR}gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:latest

2) Run to create the initial directories
   sudo ./run_gitlab.sh 

3) Configure: modify the following settings

    sudo vim gitlab/config/gitlab.rb 

         external_url 'http://localhost:8000'
         gitlab_rails['gitlab_ssh_host'] = 'localhost'
         gitlab_rails['gitlab_shell_ssh_port'] = 2222

4) Restart docker

    sudo docker restart gitlab_server

5) Visit http://localhost:8080 and login with

    root 5iveL!fe


Source:
https://gitlab.com/gitlab-org/gitlab-ce/tree/master/docker

Autostart:
https://docs.docker.com/articles/host_integration/

No comments: