Dockerfile to build a GitLab image for the Docker opensource container platform.
GitLab CE is set up in the Docker image using the install from source method as documented in the official GitLab documentation.
For other methods to install GitLab please refer to the Official GitLab Installation Guide which includes a GitLab image for Docker.
If you find this image useful here's how you can help:
See Contributors for the complete list developers that have contributed to this project.
Docker is actively being developed and tested by a thriving community of developers and testers and every release of Docker features many enhancements and bugfixes.
Given the nature of the development and release cycle it is very important that you have the latest version of Docker installed because any issue that you encounter might have already been fixed with a newer Docker release.
Install the most recent version of the Docker Engine for your platform using the official Docker releases, which can also be installed using:
wget -qO- https://get.docker.com/ | sh
Fedora and RHEL/CentOS users should try disabling selinux with setenforce 0
and check if resolves the issue. If it does than there is not much that I can help you with. You can either stick with selinux disabled (not recommended by redhat) or switch to using ubuntu.
You may also set DEBUG=true
to enable debugging of the entrypoint script, which could help you pinpoint any configuration issues.
If using the latest docker version and/or disabling selinux does not fix the issue then please file an issue request on the issues page.
In your issue report please make sure you provide the following information:
docker version
commanddocker info
commanddocker run
command you used to run the image (mask out the sensitive bits).Your docker host needs to have 1GB or more of available RAM to run GitLab. Please refer to the GitLab hardware requirements documentation for additional information.
Automated builds of the image are available on Dockerhub and is the recommended method of installation.
docker pull sameersbn/gitlab:17.3.0
You can also pull the latest
tag which is built from the repository HEAD
docker pull sameersbn/gitlab:latest
Alternatively you can build the image locally.
docker build -t sameersbn/gitlab github.com/sameersbn/docker-gitlab
The quickest way to get started is using docker-compose.
wget https://raw.githubusercontent.com/sameersbn/docker-gitlab/master/docker-compose.yml
Generate random strings that are at least 64
characters long for each of GITLAB_SECRETS_OTP_KEY_BASE
, GITLAB_SECRETS_DB_KEY_BASE
, GITLAB_SECRETS_SECRET_KEY_BASE
, GITLAB_SECRETS_ENCRYPTED_SETTINGS_KEY_BASE
. These values are used for the following:
GITLAB_SECRETS_OTP_KEY_BASE
is used to encrypt 2FA secrets in the database. If you lose or rotate this secret, none of your users will be able to log in using 2FA.GITLAB_SECRETS_DB_KEY_BASE
is used to encrypt CI secret variables, as well as import credentials, in the database. If you lose or rotate this secret, you will not be able to use existing CI secrets.GITLAB_SECRETS_SECRET_KEY_BASE
is used for password reset links, and other 'standard' auth features. If you lose or rotate this secret, password reset tokens in emails will reset.GITLAB_SECRETS_ENCRYPTED_SETTINGS_KEY_BASE
is used for reading settings from encrypted files such as SMTP or LDAP credentials.Tip: You can generate a random string using
pwgen -Bsv1 64
and assign it as the value ofGITLAB_SECRETS_DB_KEY_BASE
.
Start GitLab using:
docker-compose up
Alternatively, you can manually launch the gitlab
container and the supporting postgresql
and redis
containers by following this three step guide.
Step 1. Launch a postgresql container
docker run --name gitlab-postgresql -d \ --env 'DB_NAME=gitlabhq_production' \ --env 'DB_USER=gitlab' --env 'DB_PASS=password' \ --env 'DB_EXTENSION=pg_trgm,btree_gist' \ --volume /srv/docker/gitlab/postgresql:/var/lib/postgresql \ sameersbn/postgresql:14-20230628
Step 2. Launch a redis container
docker run --name gitlab-redis -d \ --volume /srv/docker/gitlab/redis:/data \ redis:6.2
Step 3. Launch the gitlab container
docker run --name gitlab -d \ --link gitlab-postgresql:postgresql --link gitlab-redis:redisio \ --publish 10022:22 --publish 10080:80 \ --env 'GITLAB_PORT=10080' --env 'GITLAB_SSH_PORT=10022' \ --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' \ --env 'GITLAB_SECRETS_ENCRYPTED_SETTINGS_KEY_BASE=long-and-random-alpha-numeric-string' \ --volume /srv/docker/gitlab/gitlab:/home/git/data \ sameersbn/gitlab:17.3.0
Please refer to Available Configuration Parameters to understand GITLAB_PORT
and other configuration options
NOTE: Please allow a couple of minutes for the GitLab application to start.
Point your browser to http://localhost:10080
and set a password for the root
user account.
You should now have the GitLab application up and ready for testing. If you want to use this image in production then please read on.
The rest of the document will use the docker command line. You can quite simply adapt your configuration into a docker-compose.yml
file if you wish to do so.
GitLab is a code hosting software and as such you don't want to lose your code when the docker container is stopped/deleted. To avoid losing any data, you should mount a volume at,
/home/git/data
Note: that if you are using the docker-compose
approach, you must "inspect" the volumes (docker volume inspect
) to check the mounted path.
SELinux users are also required to change the security context of the mount point so that it plays nicely with selinux.
mkdir -p /srv/docker/gitlab/gitlab sudo chcon -Rt svirt_sandbox_file_t /srv/docker/gitlab/gitlab
Volumes can be mounted in docker by specifying the -v
option in the docker run command.
docker run --name gitlab -d \ --volume /srv/docker/gitlab/gitlab:/home/git/data \ sameersbn/gitlab:17.3.0
GitLab uses a database backend to store its data. You can configure this image to use PostgreSQL.
Note: GitLab requires PostgreSQL now. So use an older image < 12.1 or migrate to PostgresSQL
Important note: This image is shipped with different versions of the postgresql-client
.
During the startup of the container, the major version of the database system is checked based on the specified connection destination. Only the version of the postgresql-client
, that matches the major version of the Postgres database is used. If the major version of any version of the included clients does not match, the latest client is used (but may cause issues). All other versions of the postgresql-client
are deleted at runtime.
This behavior can be checked using the command docker logs
and an output like the following should be available:
… Configuring gitlab::database - Installing postgresql client to avoid version mismatch on dumping -- Detected server version: 140007 - Generating /home/git/.postgresqlrc 14 postgresql:5432 gitlabhq_production - Uninstalling unused client(s): postgresql-client-12 postgresql-client-13 postgresql-client-15 …
Please note furthermore, that only compatible versions of the postgresql-client
to GitLab are shipped with this image. Currently, these belong to
postgresql-client-13
,postgresql-client-14
,postgresql-client-15
.NOTE: Version 13.7.0 and later requires PostgreSQL version 12.x. Version 16.0.0 and later requires PostgreSQL version 13.x
The image also supports using an external PostgreSQL Server. This is also controlled via environment variables.
CREATE ROLE gitlab with LOGIN CREATEDB PASSWORD 'password'; CREATE DATABASE gitlabhq_production; GRANT ALL PRIVILEGES ON DATABASE gitlabhq_production to gitlab;
Additionally, since GitLab 8.6.0
the pg_trgm
extension should also be loaded for the gitlabhq_production
database.
We are now ready to start the GitLab application.
Note: The following applies assuming that the PostgreSQL server host is 192.168.1.100
.
docker run --name gitlab -d \ --env 'DB_HOST=192.168.1.100' \ --env 'DB_NAME=gitlabhq_production' \ --env 'DB_USER=gitlab' --env 'DB_PASS=password' \ --volume /srv/docker/gitlab/gitlab:/home/git/data \ sameersbn/gitlab:17.3.0
You can link this image with a postgresql container for the database requirements. The alias of the postgresql server container should be set to postgresql while linking with the gitlab image.
If a postgresql container is linked, only the DB_HOST
and DB_PORT
settings are automatically retrieved using the linkage. You may still need to set other database connection parameters such as the DB_NAME
, DB_USER
, DB_PASS
and so on.
To illustrate linking with a postgresql container, we will use the sameersbn/postgresql image. When using postgresql image in production you should mount a volume for the postgresql data store. Please refer the README of docker-postgresql for details.
First, let's pull the postgresql image from the docker index.
docker pull sameersbn/postgresql:14-20230628
For data persistence lets create a store for the postgresql and start the container.
SELinux users are also required to change the security context of the mount point so that it plays nicely with selinux.
mkdir -p /srv/docker/gitlab/postgresql sudo chcon -Rt svirt_sandbox_file_t /srv/docker/gitlab/postgresql
The run command looks like this.
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:14-20230628
The above command will create a database named gitlabhq_production
and also create a user named gitlab
with the password password
with access to the gitlabhq_production
database.
We are now ready to start the GitLab application.
docker run --name gitlab -d --link gitlab-postgresql:postgresql \ --volume /srv/docker/gitlab/gitlab:/home/git/data \ sameersbn/gitlab:17.3.0
Here the image will also automatically fetch the DB_NAME
, DB_USER
and DB_PASS
variables from the postgresql container as they are specified in the docker run
command for the postgresql container. This is made possible using the magic of docker links and works with the following images:
When this Gitlab image upgrades its dependency on specific version of PostgreSQL you will need to make sure to use corresponding version of PostgreSQL.
If you are setting a brand new install, there is no data migration involved. However, if you already have an existing setup, the PostgreSQL data will
AI小说写作助手,一站式润色、改写、扩写
蛙蛙写作—国内先进的AI写作平台,涵盖小说、学术、社交媒体等多场景。提供续写、改写、润色等功能,助力创作者高效优化写作流程。界面简洁,功能全面,适合各类写作者提升内容品质和工作效率。
字节跳动发布的AI编程神器IDE
Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。
全能AI智能助手,随时解答生活与工作的多样问题
问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。
实时语音翻译/同声传译工具
Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世 界的语言交流不再有国界。
一键生成PPT和Word,让学习生活更轻松
讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。
深度推理能力全新升级,全面对标OpenAI o1
科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助 ,助力用户轻松获取信息、解决问题,满足多样化使用场景。
一种基于大语言模型的高效单流解耦语 音令牌文本到语音合成模型
Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。
AI助力,做PPT更简单!
咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。
选题、配图、成文,一站式创作,让内容运营更高效
讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。
专业的AI公文写作平台,公文写作神器
AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。
最新AI工具、AI资讯
独家AI资源、AI项目落地
微信扫一扫关注公众号