Skip to content

Instantly share code, notes, and snippets.

@DevoKun
Created July 9, 2019 21:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save DevoKun/e2b53ef56bbef0b7bae00693ad32985d to your computer and use it in GitHub Desktop.
Save DevoKun/e2b53ef56bbef0b7bae00693ad32985d to your computer and use it in GitHub Desktop.
Deploy GitLab using Docker

PostgreSQL and Redis

  • Gitlab CE uses Redis to store user sessions and a task queue.
  • GitLab CE uses PostgreSQL as its database back end.

Start PostgreSQL Docker Container

docker run -d --name postgresql \
  -p 5432:5432 \
  -e POSTGRES_USER=gitlab \
  -e POSTGRES_PASSWORD=gitlab \
  -e POSTGRES_DB=gitlabhq_production \
  postgres:9.6.14

Install psql client for connecting to PostgreSQL

apt install postgresql-client-common postgresql-client-10

psql -h localhost -p 5432 -U gitlab -W gitlabhq_production

Start Redis Docker Container

docker run -d --name redis -p 6379:6379 redis:latest

Start Gitlab

  • Set the external_url to the URL that will be used by Gitlab.
docker run -d --name gitlab \
  -p 30080:30080 \
  -p  7999:22 \
  --env GITLAB_OMNIBUS_CONFIG="external_url 'http://gitlab.gestalts.net:30080'; gitlab_rails['gitlab_shell_ssh_port']=7999;" \
  --link postgresql \
  --link redis \
  gitlab/gitlab-ce:latest

Connect to Gitlab and create a root username password

echo "127.0.0.1 gitlab.gestalts.net" >> /etc/hosts
  • The default Gitlab admin username is root.
  • When connecting to Gitlab for the first time, the user will be prompted to create a password for the root user.
  • Direct the web browser to the external_url set in the GITLAB_OMNIBUS_CONFIG enviroment variables: http://gitlab.gestalts.net:30080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment