Skip to content

Enable referring a private registry in gitpod Dockerfile #10204

Closed
@princerachit

Description

@princerachit

Is your feature request related to a problem? Please describe

I want to use a private registry in my gitpod dockerfile.

Describe the behaviour you'd like

I want my gitpod config to look like the following:

image:
  file: gitpod.Dockerfile

and the contents of gitpod.Dockerfile to look like this:

FROM registry.provider.com/project-base:v1

RUN apt-get install xxx
..
..

When I open my repo I expect image build to work and start a new workspace.

Describe alternatives you've considered

NA

Additional context

With existing code at the time of creating this issue I see the following error in imagebuild pod logs"

{
sudo -E /app/bob build
}; exit
bash-5.1$ {
> sudo -E /app/bob build
> }; exit
{"level":"debug","message":"buildkitd started","serviceContext":{"service":"bob","version":""},"severity":"DEBUG","stderr":"/tmp/buildkitd_stderr1507424168","stdout":"/tmp/buildkitd_stdout734526385","time":"2022-05-24T06:33:00Z"}
{"attempt":0,"level":"debug","message":"attempting to connect to buildkitd","serviceContext":{"service":"bob","version":""},"severity":"DEBUG","time":"2022-05-24T06:33:00Z"}
{"attempt":1,"level":"debug","message":"attempting to connect to buildkitd","serviceContext":{"service":"bob","version":""},"severity":"DEBUG","time":"2022-05-24T06:33:01Z"}
{"level":"info","message":"building base image","serviceContext":{"service":"bob","version":""},"severity":"INFO","time":"2022-05-24T06:33:01Z"}
{"level":"info","message":"waiting for build context","serviceContext":{"service":"bob","version":""},"severity":"INFO","time":"2022-05-24T06:33:01Z"}
#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.0s

#2 [internal] load build definition from gitpod.Dockerfile
#2 transferring dockerfile: 132B done
#2 DONE 0.0s

#3 [internal] load metadata for registry.gitlab.com/prince41/testproj/go:latest
#3 ERROR: failed to authorize: failed to fetch anonymous token: unexpected status: 403 Forbidden
------
 > [internal] load metadata for registry.gitlab.com/prince41/testproj/go:latest:
------
gitpod.Dockerfile:1
--------------------
   1 | >>> FROM registry.gitlab.com/prince41/testproj/go:latest
   2 |     
   3 |     RUN touch /tmp/abc && echo "done"
--------------------
error: failed to solve: failed to fetch anonymous token: unexpected status: 403 Forbidden
{"@type":"type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent","command":"build","error":"exit status 1","level":"error","message":"build failed","serviceContext":{"service":"bob","version":""},"severity":"ERROR","time":"2022-05-24T06:33:01Z"}
exit

Error: headless task failed: exit status 1

Same error displayed in the browser:

image

Related PRs and Code

  • Support for private registry was added in this PR. It also says that you cannot refer to private registry in the dockerfile.
  • We probably had a mini scoped version of this feature when we used to have gitpod layer. The gitpod layer was removed and the corresponding variables were renamed to be more generic. However, the code to support it is missing in image-builder-mk3 I believe. i.e. setting appropriate env vars such as BOB_WSLAYER_AUTH

Metadata

Metadata

Assignees

No one assigned

    Labels

    meta: staleThis issue/PR is stale and will be closed soon

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions