Skip to content

feat(containers): add support for handling images that link to the CF registry#9596

Merged
CarmenPopoviciu merged 4 commits intomainfrom
carmen/registry-link-image
Jun 20, 2025
Merged

feat(containers): add support for handling images that link to the CF registry#9596
CarmenPopoviciu merged 4 commits intomainfrom
carmen/registry-link-image

Conversation

@CarmenPopoviciu
Copy link
Contributor

@CarmenPopoviciu CarmenPopoviciu commented Jun 13, 2025

Fixes DEVX-1966.

the first commit adds the pulling functionality, the second just makes manual testing a bit easier. e2e testing will happen in a followup.


  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because: to do in followup. manually tested. (tracking testing followup in DEVX-1980)
  • Wrangler / Vite E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because:
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: outside the scope of this PR
  • Wrangler V3 Backport
    • TODO (before merge)
    • Wrangler PR:
    • Not necessary because: containers is an experimental feature

@changeset-bot
Copy link

changeset-bot bot commented Jun 13, 2025

🦋 Changeset detected

Latest commit: de266da

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@cloudflare/containers-shared Patch
miniflare Patch
wrangler Patch
@cloudflare/pages-shared Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jun 13, 2025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@9596

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@9596

miniflare

npm i https://pkg.pr.new/miniflare@9596

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@9596

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@9596

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@9596

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@9596

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@9596

wrangler

npm i https://pkg.pr.new/wrangler@9596

commit: de266da

if (!isCloudflareRegistryLink(options.image)) {
throw new Error(
`Image ${options.image} is a registry link but does not point to the Cloudflare container registry.\n` +
`All images must use ${getCloudflareContainerRegistry()}, which is the default registry for Wrangler. To use an existing image from another repository, see https://developers.cloudflare.com/containers/image-management/#using-existing-images`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikenomitch is this the correct url I'm using here?

* (defined as per `getCloudflareContainerRegistry` above)
*/
export function isCloudflareRegistryLink(image: string) {
const cfRegistry = getCloudflareContainerRegistry();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will create a new string everytime it gets executed. Using something like this and definining cfRegistry in global scope will remove the unnecessary string allocation.

Suggested change
const cfRegistry = getCloudflareContainerRegistry();
cfRegistry ??= getCloudflareContainerRegistry();

@emily-shen emily-shen force-pushed the carmen/registry-link-image branch from 32412fd to cd4ae0e Compare June 18, 2025 10:54
@workers-devprod workers-devprod added the e2e Run wrangler + vite-plugin e2e tests on a PR label Jun 18, 2025
@emily-shen emily-shen changed the base branch from main to emily/add-tag June 18, 2025 10:56
@emily-shen emily-shen force-pushed the carmen/registry-link-image branch from 72862dd to 26fc672 Compare June 18, 2025 12:46
@emily-shen emily-shen force-pushed the carmen/registry-link-image branch from 26fc672 to c95089e Compare June 18, 2025 12:59
@emily-shen emily-shen force-pushed the carmen/registry-link-image branch from c95089e to 41b9899 Compare June 19, 2025 11:19
@emily-shen emily-shen marked this pull request as ready for review June 19, 2025 11:21
@emily-shen emily-shen requested a review from a team as a code owner June 19, 2025 11:21
if (output === "0" && process.platform !== "linux") {
throw new Error(
`The container "${imageTag.replace(MF_DEV_CONTAINER_PREFIX + "/", "")}" does not expose any ports.\n` +
"To develop containers locally on non-Linux platforms, you must expose any ports that you call with `getTCPPort()` in your Dockerfile."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we link to the dockerfile EXPOSE docs here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linking to external docs feels a bit weird, and they come up if you just search expose ports dockerfile. but happy to if you feel strongly about it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a section in our docs about this?

Copy link
Contributor

@emily-shen emily-shen Jun 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think @mikenomitch was going to do that already :) - i'll add a ticket to link to those docs when they're up

(c) => !isDockerfile(c.image ?? c.configuration.image)
);
if (needsPulling && !resolved.dev.remote) {
await fillOpenAPIConfiguration(config, isNonInteractiveOrCI());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this pull in auth at all? ConfigController has an auth hook that we should use

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

talked about this offline, will leave sorting out containers auth out of this PR.

@emily-shen emily-shen force-pushed the carmen/registry-link-image branch from ba43bc1 to 7e4fac7 Compare June 19, 2025 14:42
Base automatically changed from emily/add-tag to main June 19, 2025 14:56
@emily-shen emily-shen force-pushed the carmen/registry-link-image branch from 7e4fac7 to de266da Compare June 19, 2025 15:10
@github-actions
Copy link
Contributor

Failed to automatically backport this PR's changes to Wrangler v3. Please manually create a PR targeting the v3-maintenance branch with your changes. Thank you for helping us keep Wrangler v3 supported!

Depending on your changes, running git rebase --onto v3-maintenance main carmen/registry-link-image might be a good starting point.

Notes:

  • your PR branch should be named v3-backport-9596
  • add the skip-v3-pr label to the current PR to stop this workflow from failing

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Jun 19, 2025
@emily-shen emily-shen enabled auto-merge June 19, 2025 16:06
@CarmenPopoviciu CarmenPopoviciu disabled auto-merge June 20, 2025 15:33
@CarmenPopoviciu CarmenPopoviciu merged commit 5162c51 into main Jun 20, 2025
54 of 56 checks passed
@CarmenPopoviciu CarmenPopoviciu deleted the carmen/registry-link-image branch June 20, 2025 16:37
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Jun 20, 2025
@emily-shen
Copy link
Contributor

tracking testing followup in DEVX-1980

jseba added a commit to jseba/workers-sdk that referenced this pull request Jun 20, 2025
…seba/containers_scope_debug

* 'main' of ssh://github.com/cloudflare/workers-sdk:
  Version Packages (cloudflare#9697)
  add remote bindings support to `getPlatformProxy` (cloudflare#9688)
  feat(containers): add support for handling images that link to the CF registry (cloudflare#9596)
  CC-5418: Set instance_type in wrangler (cloudflare#9633)
  remove warnings during config validations on `experimental_remote` fields (cloudflare#9678)
  add debug logs for workerd (cloudflare#9640)
  `wrangler containers apply` uses `observability` configuration (cloudflare#9558)
  Version Packages (cloudflare#9658)
  Temporarily skip Openapi C3 e2e tests (cloudflare#9691)
  Skip authed fixture on forks (cloudflare#9681)
jseba added a commit to jseba/workers-sdk that referenced this pull request Jun 21, 2025
…seba/containers_scope

* 'main' of ssh://github.com/cloudflare/workers-sdk:
  Add CLAUDE.md for Claude Code guidance (cloudflare#9563)
  Version Packages (cloudflare#9697)
  add remote bindings support to `getPlatformProxy` (cloudflare#9688)
  feat(containers): add support for handling images that link to the CF registry (cloudflare#9596)
  CC-5418: Set instance_type in wrangler (cloudflare#9633)
  remove warnings during config validations on `experimental_remote` fields (cloudflare#9678)
  add debug logs for workerd (cloudflare#9640)
  `wrangler containers apply` uses `observability` configuration (cloudflare#9558)
  Version Packages (cloudflare#9658)
  Temporarily skip Openapi C3 e2e tests (cloudflare#9691)
  Skip authed fixture on forks (cloudflare#9681)
if (!isCloudflareRegistryLink(options.image)) {
throw new Error(
`Image "${options.image}" is a registry link but does not point to the Cloudflare container registry.\n` +
`To use an existing image from another repository, see https://developers.cloudflare.com/containers/image-management/#using-existing-images`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this url is currently 404

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved: ece4a43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e Run wrangler + vite-plugin e2e tests on a PR

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants