标签:
一、Ubuntu16.4上Docker安装Gitlab
1、安装docker
参见:https://docs.docker.com/engine/installation/linux/ubuntulinux/
(1)安装ssh
sudo apt install vim openssh-client openssh-server
(2)安装docker
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
deb https://apt.dockerproject.org/repo ubuntu-xenial main
sudo apt-get update
sudo apt-get purge lxc-docker
apt-cache policy docker-engine
sudo apt-get update
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
sudo apt-get update
sudo apt-get install linux-image-generic-lts-trusty
curl -fsSL https://get.docker.com/ | sh
sudo usermod -aG docker username
sudo docker version
sudo docker info
(3)安装Gitlab
sudo docker pull sameersbn/gitlab:latest
sudo docker run --name gitlab-postgresql -d --env ‘DB_NAME=gitlabhq_production‘ --env ‘DB_USER=gitlab‘ --env ‘DB_PASS=password‘ --env ‘DB_EXTENSION=pg_trgm‘ --volume /srv/docker/gitlab/postgresql:/var/lib/postgresql sameersbn/postgresql:latest
sudo docker run --name gitlab-redis -d --volume /srv/docker/gitlab/redis:/var/lib/redis sameersbn/redis:latest
docker run --name gitlab -d --link gitlab-postgresql:postgresql --link gitlab-redis:redisio --publish 8001:22 --publish 8002:80 --env ‘GITLAB_PORT=8002‘ --env ‘GITLAB_SSH_PORT=8001‘ --env ‘GITLAB_HOST=IP_ADDRESS‘ --env ‘GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string‘ --env ‘GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string‘ --env ‘GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string‘ --volume /srv/docker/gitlab/gitlab:/home/username/data sameersbn/gitlab:latest
注意:红色字体根据实际情况修改。
(4)启动gitlab服务
sudo docker start gitlab-redis
sudo docker start gitlab-postgresql
sudo docker start gitlab
访问地址:http://IP_ADDRSS:8002
二、CentOS7上Docker安装Gitlab
1、安装Docker
参见:https://docs.docker.com/engine/installation/linux/centos/
2、直接使用root安装
更新系统:
yum update
配置docker镜像源
tee /etc/yum.repos.d/docker.repo <<-‘EOF‘ [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF
安装docker
yum install docker-engine
systemctl enable docker.service
systemctl start docker
docker中启动测试镜像
docker run hello-world
3、安装Gitlab
docker pull sameersbn/gitlab:latest
docker run --name gitlab-postgresql -d --env ‘DB_NAME=gitlabhq_production‘ --env ‘DB_USER=gitlab‘ --env ‘DB_PASS=password‘ --env ‘DB_EXTENSION=pg_trgm‘ --volume /srv/docker/gitlab/postgresql:/var/lib/postgresql sameersbn/postgresql:latest
docker run --name gitlab-redis -d --volume /srv/docker/gitlab/redis:/var/lib/redis sameersbn/redis:latest
docker run --name gitlab -d --link gitlab-postgresql:postgresql --link gitlab-redis:redisio --publish 8001:22 --publish 8002:80 --env ‘GITLAB_PORT=8002‘ --env ‘GITLAB_SSH_PORT=8001‘ --env ‘GITLAB_HOST=IP_ADDRESS‘ --env ‘GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string‘ --env ‘GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string‘ --env ‘GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string‘ --volume /srv/docker/gitlab/gitlab:/home/username/data sameersbn/gitlab:latest
注意:红色字体根据实际情况修改。
4、启动gitlab服务
docker start gitlab-redis
docker start gitlab-postgresql
docker start gitlab
访问地址:http://IP_ADDRESS:8002
标签:
原文地址:http://www.cnblogs.com/icsnow/p/5962695.html