Host the GitLab product documentation (FREE SELF)
If you are not able to access the GitLab product documentation at
you can host the documentation yourself instead.
- The version of the product documentation site must be the same as the version of your GitLab installation.
Documentation self-hosting options
To host the GitLab product documentation, you can use:
- A Docker container
- GitLab Pages
- Your own web server
After you create a website by using one of these methods, you redirect the UI links in the product to point to your website.
The website you create must be hosted under a subdirectory that matches
your installed GitLab version (for example,
use this version by default.
The following examples use GitLab 14.5.
Self-host the product documentation with Docker
The documentation website is served under the port
4000 inside the container.
In the following example, we expose this on the host under the same port.
Make sure you either:
- Allow port
4000in your firewall.
- Use a different port. In following examples, replace the leftmost
4000with the port different port.
To run the GitLab product documentation website in a Docker container:
On the server where you host GitLab, or on any other server that your GitLab instance can communicate with:
If you use plain Docker, run:
docker run --detach --name gitlab_docs -it --rm -p 4000:4000 registry.gitlab.com/gitlab-org/gitlab-docs:14.5
If you host your GitLab instance using Docker compose, add the following to your existing
version: '3.6' services: gitlab_docs: image: registry.gitlab.com/gitlab-org/gitlab-docs:14.5 hostname: 'https://docs.gitlab.example.com:4000' ports: - '4000:4000'
Then, pull the changes:
docker-compose up -d
http://0.0.0.0:4000to view the documentation website and verify it works.
Self-host the product documentation with GitLab Pages
You can use GitLab Pages to host the GitLab product documentation.
- Ensure the Pages site URL does not use a subfolder. Because of how the docs
main domain or subdomain. For example, URLs like
https://example.com/docs/are not supported.
To host the product documentation site with GitLab Pages:
Create a new or edit your existing
.gitlab-ci.ymlfile, and add the following
pagesjob, while ensuring the version is the same as your GitLab installation:
image: registry.gitlab.com/gitlab-org/gitlab-docs:14.5 pages: script: - mkdir public - cp -a /usr/share/nginx/html/* public/ artifacts: paths: - public
Optional. Set the GitLab Pages domain name. Depending on the type of the GitLab Pages website, you have two options:
Type of website Default domain Custom domain Project website Not supported Supported User or group website Supported Supported
Self-host the product documentation on your own web server
Because the product documentation site is static, you can take the contents of
/usr/share/nginx/html from inside the container, and use your own web server to host
the docs wherever you want.
html directory should be served as is and it has the following structure:
├── 14.5/ ├── index.html
In this example:
14.5/is the directory where the documentation is hosted.
index.htmlis a simple HTML file that redirects to the directory containing the documentation. In this case,
To extract the HTML files of the Docs site:
Create the container that holds the HTML files of the documentation website:
docker create -it --name gitlab_docs registry.gitlab.com/gitlab-org/gitlab-docs:14.5
Copy the website under
docker cp gitlab-docs:/usr/share/nginx/html /srv/gitlab/
You end up with a
/srv/gitlab/html/directory that holds the documentation website.
Remove the container:
docker rm -f gitlab_docs
Point your web server to serve the contents of
/help links to the new Docs site
After your local product documentation site is running,
redirect the help links
in the GitLab application to your local site, by using the fully qualified domain
name as the docs URL. For example, if you used the
Docker method, enter
You don't need to append the version. GitLab detects it and appends it to documentation URL requests as needed. For example, if your GitLab version is 14.5:
- The GitLab Docs URL becomes
- The link in GitLab displays as
- When you select the link, you are redirected to
To test the setting, select a Learn more link within the GitLab application.
Upgrade the product documentation to a later version
Upgrading the Docs site to a later version requires downloading the newer Docker image tag.
Upgrade using Docker
To upgrade to a later version using Docker:
If you use plain Docker:
Stop the running container:
sudo docker stop gitlab_docs
Remove the existing container:
sudo docker rm gitlab_docs
Pull the new image. For example, 14.6:
docker run --detach --name gitlab_docs -it --rm -p 4000:4000 registry.gitlab.com/gitlab-org/gitlab-docs:14.6
If you use Docker compose:
Change the version in
docker-compose.yaml, for example 14.6:
version: '3.6' services: gitlab_docs: image: registry.gitlab.com/gitlab-org/gitlab-docs:14.6 hostname: 'https://docs.gitlab.example.com:4000' ports: - '4000:4000'
Pull the changes:
docker-compose up -d
Upgrade using GitLab Pages
To upgrade to a later version using GitLab Pages:
Edit your existing
.gitlab-ci.ymlfile, and replace the
image's version number:
Commit the changes, push, and GitLab Pages pulls the new Docs site version.
Upgrade using your own web-server
To upgrade to a later version using your own web-server:
Copy the HTML files of the Docs site:
docker create -it --name gitlab_docs registry.gitlab.com/gitlab-org/gitlab-docs:14.6 docker cp gitlab_docs:/usr/share/nginx/html /srv/gitlab/ docker rm -f gitlab_docs
Optional. Remove the old site:
rm -r /srv/gitlab/html/14.5/
If you self-host the product documentation:
- The version dropdown displays additional versions that don't exist. Selecting
these versions displays a
404 Not Foundpage.
- The search displays results from
docs.gitlab.comand not the local site.
- By default, the landing page redirects to the
respective version (for example,
/14.5/). This causes the landing page https://docs.gitlab.com to not be displayed.