Repository navigation
feat(userdata): headless container-run library primitive - #490
Merged
Merged
Conversation
New pkg/userdata.GenerateContainerUserData + ContainerConfig: install Docker on demand, authenticate to a private-ECR image (skipped for public), pull, and run — headlessly, no DCV/X11. Wired through launcher.Options.ContainerScript -> BootstrapConfig.ContainerScript, spliced after StorageScript (so a containerized workload sees any mounted volumes already live) and before CustomUserData. Today, running a container image on a spawned instance meant hand-building the ecr-login/docker-pull/docker-run command string yourself; the only existing logic (cmd/app.go's containerRunWrapper) is DCV-streaming-specific (wires DISPLAY/XAUTHORITY for a GUI session), which a headless SDK consumer neither wants nor can supply. GPU (--gpus all) is inferred from InstanceType via the existing aws.DetectGPUInstance, the same inference Provision already applies to AMI selection. Fixes #353.
scttfrdmn
force-pushed
the
feat/353-headless-container-primitive
branch
from
August 7, 2026 18:17
dedd949 to
4306396
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
5 tasks done
scttfrdmn
added a commit
that referenced
this pull request
Aug 7, 2026
…kage (#491) cmd/app_byo.go and pkg/taskproto/wrapper.go each carried an independent copy of ecrImageAccount/ecrRegistryHost (the taskproto copy explicitly duplicated rather than imported, since taskproto must not depend on cmd). pkg/userdata/container.go (#353/PR #490) was about to become a third divergence point with its own slightly-different variant (ecrImageAccountHost, which also resolves the auth region). New pkg/ecrref (stdlib-only leaf): Account, RegistryHost, and AuthHost (the combined host+region lookup userdata needs, with the image's own region winning over a caller-supplied fallback). Both cmd and taskproto's existing functions become one-line aliases over it -- no call-site or test-name changes, so this is purely internal dedup.
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pkg/userdata.GenerateContainerUserData+ContainerConfig{Image, Region, InstanceType, Command}: installs Docker on demand, authenticates to a private-ECR image (skipped for public images), pulls, and runs — headlessly, no DCV/X11.launcher.Options.ContainerScript->BootstrapConfig.ContainerScript, spliced afterStorageScript(so a containerized workload sees any mounted volumes already live) and beforeCustomUserData— same ordering rationaleStorageScriptalready established for#166.--gpus all) is inferred fromInstanceTypevia the existingaws.DetectGPUInstance— the same inferenceProvisionalready applies to AMI selection, so a caller doesn't separately track "is this a GPU type?"Region), since a cross-region ECR pull must authenticate against its own region.Why not reuse pkg/taskproto's existing container-run logic
pkg/taskproto/wrapper.goalready has a very similar docker-install/ECR-login/docker-run implementation, but it's built around the fullTaskSpec(S3 staging, manifests, results bucket) — much heavier than what the issue asks for ("provision a host anddocker run <ref>"). Rather than force a caller like calque to construct aTaskSpecjust to run a container,pkg/userdatagets its own lightweight generator, following the exact precedent of the existingGenerateStorageUserData/GenerateMPIUserData(pure config → script, wired throughlauncher.Options).ecrImageAccount/ecrRegistryHost-equivalent logic is duplicated rather than imported, mirroringtaskproto's own existing duplication-with-a-comment fromcmd/app_byo.go(pkg/userdatamust not depend oncmdortaskproto).Fixes #353.
Test plan
pkg/userdata(required-field validation, public-image skips login, private-ECR logs in against the image's own region, GPU inference on/off/no-instance-type, CMD override quoting, no DCV/X11 wiring, docker-install-on-demand)pkg/launcher(ContainerScriptsplices afterStorageScriptand beforeCustomUserData; no container section when empty)go build ./...,go vet ./...,gofmt -lclean,golangci-lint run0 issues on both touched packagesmake check-docs— no drift (library-only change, no CLI surface)go test ./pkg/userdata/... ./pkg/launcher/...green; broadermake checkhas one pre-existing, unrelated failure (TestCatalogValid— filed as TestCatalogValid fails: chimerax/paraview catalog images are private ECR, not public #489, confirmed present on main viagit stash)