gitlab container registry: how to test that it's set up and working?



  • I'm trying to push for the first time to a gitlab project container registry. I am not a gitlab administrator so I can't change global settings. But as far as my project is concerned I've made sure that I have a personal access token created for the project.
    When I try to run my pipeline, it fails with a 404 error. I've recreated the steps just on the commandline to simplify things. here's what the output looks like:

    PS /Users/me/src/pipelinetests> docker login -u widgetsProjectAccessToken -p asdf mygitserver.org/myusername/pipelinetests
    

    WARNING! Using --password via the CLI is insecure. Use --password-stdin.
    Login Succeeded

    PS /Users/me/src/pipelinetests> docker build -t mygitserver.org/myusername/pipelinetests:widgetsimage .

    [+] Building 190.4s (12/12) FINISHED
    => [internal] load build definition from Dockerfile 0.0s
    => => transferring dockerfile: 37B 0.0s
    => [internal] load .dockerignore 0.0s
    => => transferring context: 2B 0.0s
    => [internal] load metadata for mcr.microsoft.com/dotnet/sdk:6.0.202-bullseye-slim-amd64 0.2s
    => [internal] load build context 0.0s
    => => transferring context: 21.82kB 0.0s
    => [1/7] FROM mcr.microsoft.com/dotnet/sdk:6.0.202-bullseye-slim-amd64@sha256:1ee95620598b9afa3046d356bb7f7863e1602075dd407c790c34d0a9833acc73 0.0s
    => => resolve mcr.microsoft.com/dotnet/sdk:6.0.202-bullseye-slim-amd64@sha256:1ee95620598b9afa3046d356bb7f7863e1602075dd407c790c34d0a9833acc73 0.0s
    => CACHED [2/7] RUN apt update && apt-get install vim -y 0.0s
    => [3/7] COPY . /builds 0.1s
    => [4/7] RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash 93.2s
    => [5/7] RUN apt-get install curl && curl -sL https://deb.nodesource.com/setup_12.x | bash - 25.7s
    => [6/7] RUN apt-get install nodejs 13.0s
    => [7/7] RUN npm install -g azure-functions-core-tools@4 --unsafe-perm true 48.4s
    => exporting to image 9.7s
    => => exporting layers 9.6s
    => => writing image sha256:2f30a1f69f875df9e4645bea95247e7f8678da89d2da04524d0fc570e3e1ce4e 0.0s
    => => naming to mygitserver.org/myusername/pipelinetests:widgetsimage 0.0s

    Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
    PS /Users/me/src/pipelinetests> docker push mygitserver.org/myusername/pipelinetests:widgetsimage

    The push refers to repository [mygitserver.org/myusername/pipelinetests]
    0ee173286353: Preparing
    4c70ac952b79: Preparing
    b00534d89ac6: Preparing
    b7482490dd9f: Preparing
    ea13d436bb8a: Preparing
    120468cee518: Waiting
    fd6a5c73e987: Waiting
    e4869730bdcc: Waiting
    c782777c8a5d: Waiting
    a45a618792f0: Waiting
    6c946b32cfe2: Waiting
    7dd4a3e7d836: Waiting
    20147d2db13c: Waiting
    9c1b6dd6c1e6: Waiting
    error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: "\n\n\n <meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">\n The page you're looking for could not be found (404)\n \n\n\n\n <a href="/">\n <img src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEwIiBoZWlnaHQ9IjIxMCIgdmlld0JveD0iMCAwIDIxMCAyMTAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggZD0iTTEwNS4wNjE0IDIwMy42NTVsMzguNjQtMTE4LjkyMWgtNzcuMjhsMzguNjQgMTE4LjkyMXoiIGZpbGw9IiNlMjQzMjkiLz4KICA8cGF0aCBkPSJNMTA1LjA2MTQgMjAzLjY1NDhsLTM4LjY0LTExOC45MjFoLTU0LjE1M2w5Mi43OTMgMTE4LjkyMXoiIGZpbGw9IiNmYzZkMjYiLz4KICA8cGF0aCBkPSJNMTIuMjY4NSA4NC43MzQxbC0xMS43NDIgMzYuMTM5Yy0xLjA3MSAzLjI5Ni4xMDIgNi45MDcgMi45MDYgOC45NDRsMTAxLjYyOSA3My44MzgtOTIuNzkzLTExOC45MjF6IiBmaWxsPSIjZmNhMzI2Ii8+CiAgPHBhdGggZD0iTTEyLjI2ODUgODQuNzM0Mmg1NC4xNTNsLTIzLjI3My03MS42MjVjLTEuMTk3LTMuNjg2LTYuNDExLTMuNjg1LTcuNjA4IDBsLTIzLjI3MiA3MS42MjV6IiBmaWxsPSIjZTI0MzI5Ii8+CiAgPHBhdGggZD0iTTEwNS4wNjE0IDIwMy42NTQ4bDM4LjY0LTExOC45MjFoNTQuMTUzbC05Mi43OTMgMTE4LjkyMXoiIGZpbGw9IiNmYzZkMjYiLz4KICA8cGF0aCBkPSJNMTk3Ljg1NDQgODQuNzM0MWwxMS43NDIgMzYuMTM5YzEuMDcxIDMuMjk2LS4xMDIgNi45MDctMi45MDYgOC45NDRsLTEwMS42MjkgNzMuODM4IDkyLjc5My0xMTguOTIxeiIgZmlsbD0iI2ZjYTMyNiIvPgogIDxwYXRoIGQ9Ik0xOTcuODU0NCA4NC43MzQyaC01NC4xNTNsMjMuMjczLTcxLjYyNWMxLjE5Ny0zLjY4NiA2LjQxMS0zLjY4NSA3LjYwOCAwbDIzLjI3MiA3MS42MjV6IiBmaWxsPSIjZTI0MzI5Ii8+Cjwvc3ZnPgo="\n alt="GitLab Logo" />\n \n

    \n 404\n

    \n <div class="container">\n

    The page could not be found or you don't have permission to view it.

    \n
    \n

    The resource that you are attempting to access does not exist or you don't have the necessary permissions to view it.

    \n

    Make sure the address is correct and that the page hasn't moved.

    \n

    Please contact your GitLab administrator if you think this is a mistake.

    \n <a href="javascript:history.back()" class="js-go-back go-back">Go back\n \n \n\n\n"

    What I've Done so far

    I've made sure that my project visibility and the settings are correct:

    enter image description here

    I've also created the personal access token - which the successful login proves.

    Questions

    In googling, it seems that some people found their container registry wasn't actually set up properly. I'm not sure how to test that if I'm not a global admin.
    So my first question is do you know of any other way I can test to make sure that it's a config issue?

    If we assume it's actually set up correctly, could it just be that I haven't specified the correct port in my push command? Like if the admin chose a non standard port, could that be the issue?

    Are there other trees I should be barking up?

    EDIT 1

    These are the options under Packages & Registries

    enter image description here



  • It looks to me like you're not pushing to the right port.

    When you go to the project space, and then go to your container registry /container_registry (or click under Packages & RegistriesContainer Registry

    Menus hove

    Or, like this if you prefer to click on Packages & Registries

    Menu click

    On this page you should see a bunch of links, one of them should have something like this,

    docker push domain:5050/myusername/pipelinetests
    

    You want to be sure you're including that :5050. That's the defualt port for the https://docs.gitlab.com/ee/administration/packages/container_registry.html . It looks like from that error, that you're targeting the actual project page.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2