Skip to content

Instantly share code, notes, and snippets.

@jpillora
Last active August 29, 2015 14:22
Show Gist options
  • Save jpillora/6eb2417464fe960ecba6 to your computer and use it in GitHub Desktop.
Save jpillora/6eb2417464fe960ecba6 to your computer and use it in GitHub Desktop.
Gitlab Docker setup
#gitlab requires postgres and redis
#all 3 containers store their data in /opt
#the only variables that really need to be set
#are: GITLAB_HOST and GITLAB_ROOT_PASSWORD
mkdir -p /opt/postgresql/data
docker run --name 'postgresql-gitlab' \
-d \
-e 'DB_USER=gitlab_user' \
-e 'DB_PASS=gitlab_pass' \
-e 'DB_NAME=gitlab_db' \
-v /opt/postgresql/data:/var/lib/postgresql \
--restart always \
sameersbn/postgresql:latest
mkdir -p /opt/redis
docker run --name 'redis-gitlab' \
-d \
-v /opt/redis:/var/lib/redis \
--restart always \
sameersbn/redis:latest
mkdir -p /opt/gitlab/logs
mkdir -p /opt/gitlab/data
docker run --name='gitlab' \
-d \
-e 'GITLAB_HOST=<CHANGE-ME>' \
-e 'GITLAB_PORT=80' \
-e 'GITLAB_SSH_PORT=2200' \
-e 'GITLAB_ROOT_PASSWORD=<CHANGE-ME>' \
-e 'GITLAB_BACKUPS=daily' \
-p 2200:22 \
-p 10080:80 \
-v /opt/gitlab/logs:/var/log/gitlab \
-v /opt/gitlab/data:/home/git/data \
-v /var/run/docker.sock:/run/docker.sock \
-v $(which docker):/bin/docker \
--restart always \
sameersbn/gitlab:7.9.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment