Run a Gitlab server using Docker
Objective
Configure a Gitlab CE server on your local machine.
Instructions
First, install Docker:
brew cask install docker
It will request admin access.
Then, download and run the Gitlab image:
docker run \
--detach \
--publish 443:443 \
--publish 80:80 \
--publish 22:22 \
--name gitlab \
gitlab/gitlab-ce:latest
This will download and start a GitLab CE container and publish ports needed to
access SSH, HTTP and HTTPS. The format for publishing ports is
hostPort:containerPort
.
Before proceeding any further, make sure the container is running. You can check the status with:
docker ps -a
status
should be healthy
.
Finally, you can configure the server. The very first time you visit GitLab, you will be asked to set up the admin password. After you change it, you can login with username root and the password you set up.
If you have git repositories you would like to push to the Gitlab server running on localhost:
cd existing_folder
git init
git remote add origin \
{http://{computer_user}@localhost/{gitlab_user}/{repo_name}.git}
git add .
git commit -m "Initial commit"
git push -u origin master
It will ask your for your Gitlab user account password.