I have installed gitlab-ce on my own server and the container-registry was immediately available. When I try to push a docker-image to the container registry I get a:
This text will be blurred1253e8c66eee: Preparing 19b7c4812d37: Preparing 68ecd7dcf510: Preparing c4831d461edd: Preparing a320c397ec46: Preparing f35f5f2080bd: Waiting 58bf93aeb614: Waiting 2f648dff2b08: Waiting bf63529fa390: Waiting 38a1da6431c0: Waiting 97c0c55f9260: Waiting 91dde784976e: Waiting 61bda4f5c10f: Waiting 9a022662d4ac: Waiting 55b0db2111ac: Waiting 60e6c2d9d442: Waiting 2101d3c01933: Waiting 751f5d9ad6db: Waiting 17587239b3df: Waiting 9e63c5bce458: Waiting error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: "<!DOCTYPE html>\n<html>\n<head>\n <meta content=\"width=device-width, initial-scale=1, maximum-scale=1\" name=\"viewport\">\n <title>The page you're looking for could not be found (404)</title>\n <style>\n body {\n color: #666;\n text-align: center;\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n margin: auto;\n font-size: 14px;\n }\n\n h1 {\n font-size: 56px;\n line-height: 100px;\n font-weight: 400;\n color: #456;\n }\n\n h2 {\n font-size: 24px;\n color: #666;\n line-height: 1.5em;\n }\n\n h3 {\n color: #456;\n font-size: 20px;\n font-weight: 400;\n line-height: 28px;\n }\n\n hr {\n max-width: 800px;\n margin: 18px auto;\n border: 0;\n border-top: 1px solid #EEE;\n border-bottom: 1px solid white;\n }\n\n img {\n max-width: 40vw;\n display: block;\n margin: 40px auto;\n }\n\n a {\n line-height: 100px;\n font-weight: 400;\n color: #4A8BEE;\n font-size: 18px;\n text-decoration: none;\n }\n\n .container {\n margin: auto 20px;\n }\n\n .go-back {\n display: none;\n }\n\n </style>\n</head>\n\n<body>\n <a href=\"/\">\n <img src=\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEwIiBoZWlnaHQ9IjIxMCIgdmlld0JveD0iMCAwIDIxMCAyMTAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2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"container\">\n <h3>The page could not be found or you don't have permission to view it.</h3>\n <hr />\n <p>The resource that you are attempting to access does not exist or you don't have the necessary permissions to view it.</p>\n <p>Make sure the address is correct and that the page hasn't moved.</p>\n <p>Please contact your GitLab administrator if you think this is a mistake.</p>\n <a href=\"javascript:history.back()\" class=\"js-go-back go-back\">Go back</a>\n </div>\n <script>\n (function () {\n var goBack = document.querySelector('.js-go-back');\n\n if (history.length > 1) {\n goBack.style.display = 'inline';\n }\n })();\n </script>\n</body>\n</html>\n"
what is that? I mean I can login successfully, so why the 404?
Hi Y’all – I also am having this issue: docker login succeeds, the push fails with this 404 error (both from the command line and as part of a CI process). I’ve experienced this behavior with both v12.10 and v13.2; with my user/pass and also user/token (as well as nonce CI credentials). I’m the owner of the repository (“docker/testbuild” so no special characters or anything there) and an admin of the GitLab CE installation. My configuration with regard to the container registry is the installation default. Any advice would be appreciated! Thanks.
It turns out I didn’t read the documentation throughly enough (or my reading comprehension was sub-optimal). Uncommenting these parameters and re-configuring GitLab seems to have solved my issue:
registry_external_url 'https://gitlab.example.com:5050'
### Settings used by GitLab application
gitlab_rails['registry_enabled'] = true
gitlab_rails['registry_host'] = "gitlab.example.com"
gitlab_rails['registry_port'] = "5050"
This all makes sense really. There’s no reason a docker push to an HTTPS port should do anything useful.
I use a dedicated subdomain for the registry (the subdomain is not a child of gitlab - this is possible, but not a must)
My SSL certs are offloaded at nginx, meaning that all traffic to gitlab and the registry are forwarded using http (from the docker host to the docker container)
nginx forwards traffic for both gitlab and the registry to the same Docker port 80 (using local port 31080). The gitlab container knows from the header to assign traffic to gitlab or the registry
Specifically, what caused the 404 error for me on docker push was that I had nginx set up correctly, but:
Conclusion: If you’re doing SSL offloading at the reverse-proxy, make sure you disable any SSL at the Gitlab Docker container.
Two notes:
This is an ‘internal’ SSL setup, meaning that my Gitlab can only be reached from the LAN side. however, for the setup, this really does not matter. The configs above would work the same in a public setting.
Since I wanted to preserve the SSH port 22 to connect to my LXC, my repositories are all made available on a different port, meaning that I clone my repositories with this specific port, e.g. ssh://git@gitlab.local.mydomain.tld:9999/configs/nginx-docker-gl.git