Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

404 when executing docker push to gitlab-container-registry

I have installed gitlab-ce 13.2.0 on my server and the container-registry was immediately available.

from a other sever (or my local machine) I can login, but when pushing a image to the container-registry I get a 404-error: error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: "<!DOCTYPE html>\n<html>\n<head>...

in my gitlab.rb I have:

external_url 'https://git.xxxxxxxx.com'
nginx['enable'] = true
nginx['client_max_body_size'] = '250m'
nginx['redirect_http_to_https'] = true

nginx['ssl_certificate'] = "/etc/gitlab/trusted-certs/xxxxxxxx.com.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/trusted-certs/xxxxxxxx.com.key"
nginx['ssl_protocols'] = "TLSv1.1 TLSv1.2"

registry_external_url 'https://git.xxxxxxxx.com'

what is confusing, is that the registry_external_url is the same as the external_url. There are those lines in the gitlab.rb:

### Settings used by GitLab application
# gitlab_rails['registry_enabled'] = true
# gitlab_rails['registry_host'] = "git.xxxxxxxx.com"
# gitlab_rails['registry_port'] = "5005"
# gitlab_rails['registry_path'] = "/var/opt/gitlab/gitlab-rails/shared/registry"

But when I uncomment this, I cannot login.

what can be the problem here?

like image 932
CaptnHirni Avatar asked Jul 27 '20 20:07

CaptnHirni


People also ask

Does GitLab have a Docker registry?

GitLab Container Registry is a secure and private registry for Docker images. Built on open source software, GitLab Container Registry isn't just a standalone registry; it's completely integrated with GitLab.

Where is GitLab container registry?

Once enabled for your GitLab instance, to enable Container Registry for your project: Go to your project's Settings > General page. Expand the Visibility, project features, permissions section and enable the Container Registry feature on your project. For new projects this might be enabled by default.

Is there a docker registry for GitLab?

Gitlab has a Docker container registry included in their services. Integrating Gitlab container registry is really simple if you are aleady using Gitlab to host your code.

How do I integrate GitLab container registry into my project?

Gitlab has a Docker container registry included in their services. Integrating Gitlab container registry is really simple if you are aleady using Gitlab to host your code. This guide explains how you can integrate Gitlab container registry into your project. To build Docker images we use the latest docker image image: docker:latest .

How do I use GitLab CI CD with Docker images?

Use GitLab CI/CD to build and push images to the Container Registry. Use it to test, build, and deploy your project from the Docker image you created. Before you can build and push images by using GitLab CI/CD, you must authenticate with the Container Registry.

How many tags can you have in a GitLab container repository?

If you are on GitLab self-managed instances and you have 1000+ tags in a container repository, you might run into a Container Registry token expiration issue , with error authorizing context: invalid token in the logs. If you are on GitLab 13.9 or later, you can set limits for the cleanup policy .


1 Answers

This is actually because you are using https port without proxying the registry in nginx.

Fix these lines according to the following in gitlab.rb:

registry_nginx['enable'] = true
registry_nginx['listen_https'] = true
registry_nginx['redirect_http_to_https'] = true
registry_external_url 'https://registry.YOUR_DOMAIN.gtld'

You don't need to touch nginx['ssl_*] parameters when you are using letsencrypt since the chef would take care.

like image 98
Salehi Avatar answered Oct 21 '22 07:10

Salehi