Pushing to local repo over http is a real pita #3297
Glenn D. opened 1 day ago

Hey everyone,

I am running OneDev internally only, so I had it hosted on http. However, when I try to push to a local registry, all sorts of errors pop up. I read the instructions on how to allow insecure registries, but that process seems very cumbersome, and to be honest, I understand only about half of what is written there.

Instead, I tried using local https using Caddy's local certificate root. I have gotten everything working except for one thing: pushing to the registry. On the same documentation page for the isecure registry, there is a mention of creating a new buildx definition with a parameter to disable the certificate check. But again, I don't understand what I have to do.

I was wondering if disabling certificate checks would be possible. Buildx has a registry.insecure=true flag that can be passed in the --output parameter, but when I go to the build step's More Settings > More Options and I try to add --output registry.insecure=true, I get error: Option '--output' is reserved. If I add it without the --output it gets added to the --push parameter which does not recognize the flag. Is there a way to set registry.insecure=true or can this be added?

I hate how cumbersome it is just to push to a local registry 😔

  • Service Desk commented 1 day ago

    @stitch10925 You can disable certificate verification for this registry through the Buildx builder configuration. The Build Image step currently reserves --output and does not expose registry.insecure as an output setting, so it cannot be supplied through More Options.

    For your current HTTPS through Caddy setup, assuming you use a Docker executor:

    1. On the machine that runs the build, create a file named onedev-buildkitd.toml containing:

      [registry."onedev.lan"]
        insecure = true
      

      Replace onedev.lan with the registry hostname used in your image tag. Include the port if your image tag includes one, for example onedev.lan:8443. Do not include https:// or the project/image path.

    2. Create a builder using that file:

      docker buildx create --name onedev-local-registry \
        --driver docker-container \
        --buildkitd-config ./onedev-buildkitd.toml
      
      docker buildx inspect onedev-local-registry --bootstrap
      

      Run these commands as the OS user whose Docker client runs the job, using the same Docker daemon as the executor. This creates a separate builder and preserves your existing builder/cache. Docker documents this configuration mechanism in Configure BuildKit.

    3. In Administration → Job Executors, edit the Docker executor used by the job. Under More Settings, set Buildx Builder to onedev-local-registry and save. Keep the build step's output as Push to container registry, keep your registry credentials, and remove the attempted --output/registry.insecure=true additions from More Options.

    If OneDev or its agent runs in a container, its Docker client must also see the builder you created. When creating it on the host, add a bind mount such as -v /absolute/path/to/host-user/.docker/buildx:/root/.docker/buildx to the existing server/agent container configuration (adjust the destination for its actual user). For remote Docker executors, configure every eligible agent. These deployment details are covered in the OneDev registry guide.

    For plain HTTP, use http = true instead of insecure = true in the TOML file. They are different settings: HTTP transport versus skipping HTTPS certificate verification. See Docker's registry configuration.

    Since you have Caddy's local CA, another option is to configure ca = ["/absolute/path/to/caddy-root.crt"] instead of insecure = true before creating the builder, which retains certificate verification. If an error specifically mentions fetching an authentication token, the Docker/Buildx client may also need to trust that CA.

    Does this get the push working? If it still fails, please share the exact error, your OneDev version, executor type, and whether the server/agent runs in Docker so we can give instructions for that setup.

  • Glenn D. commented 1 day ago

    With registry.insecure=true is was trying to avoid having to create a new build configuration; otherwise, I could have simply created a new build configuration using the http = true flag. Will registry.insecure=true be exposed via the build step configuration, for example as slider? That would make the whole process a lot more simple and wouldn't require me to create new build configurations on every agent.

  • Service Desk commented 1 day ago

    @stitch10925 Understood—you want this configured once in the build step, without setting up a custom Buildx builder on every agent. The Build Image step currently has no setting for registry.insecure=true.

    @robin Could you decide whether to expose this as an option under Push to container registry? The per-agent builder workaround does not meet the requested workflow. This needs a feature decision before we can confirm whether it will be added.

1/1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
OD-3297
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover