Because the company's code server has been built using gitosis, but due to user and rights management too cumbersome,
Now want to build Gitlab on the original server, use the Gitlab official method to install directly,
can cause conflicts with gitosis, making gitosis unusable,
Because we want to keep two services at the same time, we think of using Docker to build Gitlab.
The following is an example of installing Docker and Gitlab in Ubuntu 14.04
Installing Docker
Enter a command in bash to install the latest Docker
sudo-ssudo shsudo apt-get updatesudo apt-get install lxc-docker
Download image
The script will download the Gitlab,mysql,redis image
docker pull sameersbn/gitlab:latestdocker pull sameersbn/mysql:latest docker pull sameersbn/redis:latest
Start Redis
docker run --name=gitlab_redis -tid sameersbn/redis:latest
Start MySQL
mkdir -p /opt/gitlab/mysqldocker run --name=gitlab_mysql -tid -e‘DB_NAME=gitlabhq_production‘ -e‘DB_USER=gitlab‘ -e‘DB_PASS=password‘ -v /opt/gitlab/mysql:/var/lib/mysql sameersbn/mysql:latest
Start Gitlab
mkdir -p /opt/gitlab/data /opt/gitlab/logdocker run --name=‘gitlab‘ -itd --link gitlab_mysql:mysql --link gitlab_redis:redisio -e‘GITLAB_PORT=80‘ -e‘GITLAB_SSH_PORT=22‘ 10022:2210080:80 -v /var/run/docker.sock:/run/docker.sock -v $(which docker):/bin/docker -v /opt/gitlab/data:/home/git/data -v /opt/gitlab/log:/var/log/gitlab sameersbn/gitlab:latest
This step takes a few minutes, as this step will do some initialization, and we can see the installation process through Docker logs Gitlab.
We specify 10022 as the access port for SSH, 10080 as the access port for HTTP,
After execution, after a little over 1-2 minutes, open the following address should be able to access the Gitlab
http://localhost:10080
If you are building on a server, replace localhost with the server address
Join boot Start
Join/etc/rc.local
echo‘docker start gitlab_redis‘ >> /etc/rc.localecho‘docker start gitlab_mysql‘ >> /etc/rc.localecho‘docker start gitlab‘ >> /etc/rc.local
How to enter a server in Docker
- If you are using Docker with the 1.3.0 version above, use the following command:
exec -it gitlab bash
- If you are using an older version, use the following command:
docker run --rm --volume=/usr/local/bin:/target jpetazzo/nsentersudo docker-enter gitlab
Backup and Recovery Gitlab
docker stop gitlab && docker rm gitlabdocker run --name=gitlab -it --rm [OPTIONS] sameersbn/gitlab:latest app:rake gitlab:backup:create
docker stop gitlab && docker rm gitlabdocker run --name=gitlab -it --rm [OPTIONS] sameersbn/gitlab:latest app:rake gitlab:backup:restore
Upgrade Gitlab
docker pull sameersbn/gitlab:7.11.4
- Stopping and deleting the current Gitlab process
docker stop gitlabdocker rm gitlab
docker run --name=‘gitlab‘ -itd --link gitlab_mysql:mysql --link gitlab_redis:redisio -e‘GITLAB_PORT=80‘ -e‘GITLAB_SSH_PORT=22‘ 10022:2210080:80 -v /var/run/docker.sock:/run/docker.sock -v $(which docker):/bin/docker -v /opt/gitlab/data:/home/git/data -v /opt/gitlab/log:/var/log/gitlab sameersbn/gitlab:latest
This article * Noodle
The source of this article: http://www.aswifter.com/2015/06/14/gitlab-with-docker/
Reprint please indicate the source of this article at the beginning.
Welcome to my public number, share swift development, Android development and Internet content
Number: App developer
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Deploying Gitlab with Docker