Add container-compose: docker-compose compatibility layer#1736
Open
demostenex wants to merge 2 commits into
Open
Add container-compose: docker-compose compatibility layer#1736demostenex wants to merge 2 commits into
demostenex wants to merge 2 commits into
Conversation
a68d59c to
92270ef
Compare
Introduces a Python script and supporting materials that allow users to bring up multi-container applications described in a standard docker-compose.yml using Apple's container CLI, without rewriting their existing compose files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
92270ef to
e835855
Compare
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.
Type of Change
Motivation and Context
Users migrating from Docker commonly describe their applications in
docker-compose.ymlfiles. ThecontainerCLI operates on individual containers and has no equivalent ofdocker compose up. This PR fills that gap with a lightweight Python script (container-compose) that reads a standard compose file and translates each subcommand into the equivalentcontainerinvocations.No changes are made to the
containerbinary or any Swift sources — this is entirely additive, living inexamples/anddocs/.What's included
examples/compose-example/container-compose— the script itself (~800 lines of Python 3, single dependency: PyYAML). Supported subcommands:up,down,ps,logs,exec,build,pull,start,stop,restart,rm,run,config.Key behaviours:
depends_ontopological order (list and condition-dict form)com.container-compose.projectandcom.container-compose.servicefor scopedps/down-porCOMPOSE_PROJECT_NAMEexamples/compose-example/docker-compose.yml— three-service example (nginx + Node.js API + Redis) exercising ports, volumes, networks, resource limits, build definitions anddepends_on.examples/compose-example/README.md— step-by-step walkthrough: install, up, ps, logs, exec, run, build, down.docs/container-compose.md— reference page covering supported compose keys, project isolation, and known limitations.Known limitations (documented)
containerhas nonetwork connect)extra_hosts: host-gatewayrestartpoliciescontainer runhealthcheckcontainer inspectoutputTesting
Unit tests (
examples/compose-example/test_container_compose.py) — 61 tests covering all pure functions:_parse_json_lines,_as_list,_label_value,service_container_name,project_name,ordered_services, andbuild_run_args(image, labels, env, ports, volumes, networks, resources, entrypoint, command, caps, workdir, user, flags).Run with:
cd examples/compose-example pip3 install pyyaml --break-system-packages python3 -m unittest discover -v🤖 Generated with Claude Code