安装Docker-CE
yum install -y yum-utils device-mapper-persistent-data
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce
配置
systemctl start docker
systemctl enable docker
安装Docker-compose
安装Docker-Compose之前,请先安装 python-pip
- 首先检查linux有没有安装python-pip包,终端执行
pip -V
- 没有python-pip包就执行命令
yum -y install epel-release
- 执行成功之后,再次执行
yum -y install python-pip
- 对安装好的pip进行升级
pip install --upgrade pip
- 安装Docker-Compose
pip install docker-compose
- 检查docker-compose 安装:
docker-compose -version
参考链接:https://www.cnblogs.com/YatHo/p/7815400.html
使用Docker-Compose安装Gitlab
使用sameersbn/gitlab镜像,相关说明参考:https://hub.docker.com/r/sameersbn/gitlab/
sameersbn和bitnami有很多常用的开发软件的docker镜像,有时间可以研究下。
- 下载yml文件
wget https://raw.githubusercontent.com/sameersbn/docker-gitlab/master/docker-compose.yml
- 修改yml配置
version: '2'
services:
redis:
restart: always
image: sameersbn/redis:4.0.9-1
command:
- --loglevel warning
volumes:
- /srv/docker/gitlab/redis:/var/lib/redis:Z
postgresql:
restart: always
image: sameersbn/postgresql:10
volumes:
- /srv/docker/gitlab/postgresql:/var/lib/postgresql:Z
environment:
- DB_USER=gitlab
- DB_PASS=password #Postgresql密码
- DB_NAME=gitlabhq_production
- DB_EXTENSION=pg_trgm
gitlab:
restart: always
image: sameersbn/gitlab:11.4.5
depends_on:
- redis
- postgresql
ports:
- "10080:80" #gitlab访问端口
- "10022:22" #SSH连接的端口
volumes:
- /srv/docker/gitlab/gitlab:/home/git/data:Z
environment:
- DEBUG=false
- DB_ADAPTER=postgresql
- DB_HOST=postgresql
- DB_PORT=5432
- DB_USER=gitlab
- DB_PASS=password #和上方Postgresql密码一致
- DB_NAME=gitlabhq_production
- REDIS_HOST=redis
- REDIS_PORT=6379
- TZ=Asia/Beijing #时区
- GITLAB_TIMEZONE=Beijing #一样是时区,填错运行不起来
- GITLAB_HTTPS=false #Https开关
- SSL_SELF_SIGNED=false
- GITLAB_HOST=domain.com #gitlab的主机入口,可以用域名或者ip(这里涉及之后项目签出的链接)
- GITLAB_PORT=10080 #gitlab访问端口和上方一致
- GITLAB_SSH_PORT=10022 #SSH连接的端口和上方一致
- GITLAB_RELATIVE_URL_ROOT=
- GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alphanumeric-string
- GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alphanumeric-string
- GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alphanumeric-string
- GITLAB_ROOT_PASSWORD=gitlabpass #Gitlab的root密码
- GITLAB_ROOT_EMAIL=a@b.com #root账户的邮箱
- GITLAB_NOTIFY_ON_BROKEN_BUILDS=true
- GITLAB_NOTIFY_PUSHER=false
- GITLAB_EMAIL=a@b.com #程序邮箱
- GITLAB_EMAIL_REPLY_TO=a@b.com #回复邮箱
- GITLAB_INCOMING_EMAIL_ADDRESS=a@b.com
- GITLAB_BACKUP_SCHEDULE=disable #备份,disable, daily, weekly or monthly(磁盘容量小最好别daily)
- GITLAB_BACKUP_TIME=01:00 #备份计划执行时间
# SMTP配置
- SMTP_ENABLED=false
- SMTP_DOMAIN=smtp.gmail.com
- SMTP_HOST=smtp.gmail.com
- SMTP_PORT=587
- SMTP_USER=mailer@example.com
- SMTP_PASS=password
- SMTP_STARTTLS=true
- SMTP_AUTHENTICATION=login
# IMAP配置
- IMAP_ENABLED=false
- IMAP_HOST=imap.gmail.com
- IMAP_PORT=993
- IMAP_USER=mailer@example.com
- IMAP_PASS=password
- IMAP_SSL=true
- IMAP_STARTTLS=false
- OAUTH_ENABLED=false
- OAUTH_AUTO_SIGN_IN_WITH_PROVIDER=
- OAUTH_ALLOW_SSO=
- OAUTH_BLOCK_AUTO_CREATED_USERS=true
- OAUTH_AUTO_LINK_LDAP_USER=false
- OAUTH_AUTO_LINK_SAML_USER=false
- OAUTH_EXTERNAL_PROVIDERS=
- OAUTH_CAS3_LABEL=cas3
- OAUTH_CAS3_SERVER=
- OAUTH_CAS3_DISABLE_SSL_VERIFICATION=false
- OAUTH_CAS3_LOGIN_URL=/cas/login
- OAUTH_CAS3_VALIDATE_URL=/cas/p3/serviceValidate
- OAUTH_CAS3_LOGOUT_URL=/cas/logout
- OAUTH_GOOGLE_API_KEY=
- OAUTH_GOOGLE_APP_SECRET=
- OAUTH_GOOGLE_RESTRICT_DOMAIN=
- OAUTH_FACEBOOK_API_KEY=
- OAUTH_FACEBOOK_APP_SECRET=
- OAUTH_TWITTER_API_KEY=
- OAUTH_TWITTER_APP_SECRET=
- OAUTH_GITHUB_API_KEY=
- OAUTH_GITHUB_APP_SECRET=
- OAUTH_GITHUB_URL=
- OAUTH_GITHUB_VERIFY_SSL=
- OAUTH_GITLAB_API_KEY=
- OAUTH_GITLAB_APP_SECRET=
- OAUTH_BITBUCKET_API_KEY=
- OAUTH_BITBUCKET_APP_SECRET=
- OAUTH_SAML_ASSERTION_CONSUMER_SERVICE_URL=
- OAUTH_SAML_IDP_CERT_FINGERPRINT=
- OAUTH_SAML_IDP_SSO_TARGET_URL=
- OAUTH_SAML_ISSUER=
- OAUTH_SAML_LABEL="Our SAML Provider"
- OAUTH_SAML_NAME_IDENTIFIER_FORMAT=urn:oasis:names:tc:SAML:2.0:nameid-format:transient
- OAUTH_SAML_GROUPS_ATTRIBUTE=
- OAUTH_SAML_EXTERNAL_GROUPS=
- OAUTH_SAML_ATTRIBUTE_STATEMENTS_EMAIL=
- OAUTH_SAML_ATTRIBUTE_STATEMENTS_NAME=
- OAUTH_SAML_ATTRIBUTE_STATEMENTS_FIRST_NAME=
- OAUTH_SAML_ATTRIBUTE_STATEMENTS_LAST_NAME=
- OAUTH_CROWD_SERVER_URL=
- OAUTH_CROWD_APP_NAME=
- OAUTH_CROWD_APP_PASSWORD=
- OAUTH_AUTH0_CLIENT_ID=
- OAUTH_AUTH0_CLIENT_SECRET=
- OAUTH_AUTH0_DOMAIN=
- OAUTH_AZURE_API_KEY=
- OAUTH_AZURE_API_SECRET=
- OAUTH_AZURE_TENANT_ID=
- 执行安装(要在yml文件的当前文件夹哦)
docker-compose up -d
简单粗暴。