Skip to main content

compose2pod

PyPI version Supported Python versions Downloads Coverage CI License GitHub stars Context7 uv Ruff ty

Convert a Docker Compose file into a POSIX sh script that runs its services as a single Podman pod.

Built for CI and test environments where you can't use docker compose or podman kube play:

  • No bridge networking / netavark. Unprivileged CI containers often have a read-only /proc/sys, so netavark fails to create bridge networks. A single pod shares one network namespace with no bridge: services talk over 127.0.0.1, and names resolve via a generated /etc/hosts the script owns.
  • No systemd. Podman healthchecks are normally scheduled by systemd timers. compose2pod gates startup by polling podman healthcheck run directly, so depends_on: service_healthy works without systemd.
  • No heavy runtime. The core is stdlib-only — no dependencies, no compiled wheels — so it installs and runs in minimal Python images.

Requirements

compose2pod's generated scripts own /etc/hosts: they write it to a temp file and bind-mount it read-only into every container under --no-hosts (see architecture/supported-subset.md), so pod-internal name resolution works on any Podman version. host.containers.internal / host.docker.internal are not provided — add an explicit extra_hosts entry if you need them.

Install

pip install compose2pod            # core: reads compose as JSON
pip install compose2pod[yaml]      # optional: read YAML directly (adds PyYAML)

Usage

# YAML directly (needs the [yaml] extra)
compose2pod docker-compose.yml --target app --image myimage:ci > run.sh

# Or stay dependency-free by piping JSON (e.g. via yq)
yq -o=json '.' docker-compose.yml | compose2pod --target app --image myimage:ci > run.sh

sh ./run.sh

Supported compose subset

compose2pod refuses every document docker compose config refuses — a measured property, checked continuously by a differential conformance harness that runs the real Docker CLI and the real compose2pod pipeline over the same YAML. So a file that compiles is a file Docker would run; where compose2pod still refuses a form Docker accepts, it is because Podman genuinely cannot express it (each such case is documented, not guessed).

Within that boundary it covers most of what real compose files use:

  • Servicesimage/build, command/entrypoint, environment and env_file (string and long-form {path, required, format}), volumes (short-form and long-form --mount, including the bind/volume/tmpfs option maps), tmpfs, healthcheck, depends_on (all conditions), network aliases, hostname/container_name.
  • Confinement & metadatauser, working_dir, read_only, init, privileged, cap_add/cap_drop, security_opt, devices, group_add, platform, labels, annotations, pull_policy (the quoted-boolean and YAML-1.1 spellings Docker accepts, too).
  • Resources — the legacy keys (mem_limit, cpus, pids_limit, ulimits, …) and the modern deploy.resources block.
  • Pod-widedns/dns_search/dns_opt, sysctls, extra_hosts.
  • Composition — same-file extends, secrets/configs, profiles.

Compose extension fields (any x--prefixed key) and YAML anchors are accepted as-is, so a top-level x-* anchor block for shared config just works. ${VAR}-style variable interpolation is left live in the generated script, resolved by its shell against the environment present when the script runs (no .env file support). See architecture/supported-subset.md for the full accept/ignore/reject matrix and planning/decisions/ for the boundary rulings.

Status

Beta. Part of the modern-python family. MIT licensed.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

compose2pod-0.4.1.tar.gz (57.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

compose2pod-0.4.1-py3-none-any.whl (65.8 kB view details)

Uploaded Python 3

File details

Details for the file compose2pod-0.4.1.tar.gz.

File metadata

  • Download URL: compose2pod-0.4.1.tar.gz
  • Upload date:
  • Size: 57.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for compose2pod-0.4.1.tar.gz
Algorithm Hash digest
SHA256 80d34bf2b56263accbb756751baa9682a3a46a6a4ba983d4212d73fe06136b7c
MD5 c661db50ff28f4b31489f4289b968dac
BLAKE2b-256 c8104d37c6e2a9d269ba12998fbca5d1f32789ae45539e2a581571f3c607b232

See more details on using hashes here.

File details

Details for the file compose2pod-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: compose2pod-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 65.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for compose2pod-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 85fdaf0cd6b21633bf31dd81f18053ed98ede28b47d35f4293ba4b46e5ef226f
MD5 1a89c2880fafc33c779d578fa18f219b
BLAKE2b-256 ae113283b2f349ece52ee0112b0257c280d6ff6b71cf6a8618eec4764281c747

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page