feat: add run subcommand and Compose resource limit support - #159
Open
dodyirawan85 wants to merge 3 commits into
Open
dodyirawan85 wants to merge 3 commits into
dodyirawan85 wants to merge 3 commits into
Conversation
Signed-off-by: dodyirawan85 <dev.irawans@gmail.com>
Signed-off-by: dodyirawan85 <dev.irawans@gmail.com>
Signed-off-by: dodyirawan85 <dev.irawans@gmail.com>
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
Adds
container-compose runfor one-off service commands, and maps Composeresource options onto Apple Container flags for
up,run, andbuild.Changes
Resource limits (
ResourceArguments)cpus,mem_limit,mem_reservation,shm_size,tmpfs,ulimits(short +
{soft, hard}forms), plusdeploy.resourceslimits/reservations.--cpus,--memory,--shm-size,--tmpfs,--ulimit.deploy.resourcesvalues win over legacy shorthands; conflicts andunsupported keys (soft reservations, device/GPU reservations, replicas) are
reported as notes.
up,run, andbuild.runsubcommandcontainer-compose run [OPTIONS] SERVICE [COMMAND...]with the trailingcommand overriding the service command.
-d/--detach,--rm,--no-deps,-P/--service-ports,-p,-e,-v,-u,-l,--entrypoint,--name,--build,--no-cache,-T/--no-tty,--env-from-file.--service-ports/-pis given.depends_onservices are started detached first unless--no-deps.ContainerRun, so interactiveshells get correct TTY/raw-mode/stdin handling and exit codes propagate.
--rmreclaims a stale same-name container; without it a clearcontainerNameTakenerror is raised.extra_hostsvia a generated, per-run hosts file bind-mounted over/etc/hosts(Apple Container has no--add-hostflag); the file is removedafter foreground runs and stale ones are swept by
down.Misc
name(the sampledirectory contains a space) and official resource limits.
Testing
swift test --test-product Container-Compose-StaticTests: 266 tests pass,including new
ComposeRunTestsandResourceOptionsTests.--rmnamereclaim, and
container inspectconfirming cpus/memory/shm/tmpfs/ulimits(e.g.
cpus: "1.5"→ 2 with a rounding note).Notes / Limitations
replicas; these are ignored with notes.
runhas no container-w/--workdiroverride (--workdirstays the localworking directory); set
working_dirin the compose file.