### Setup development environment Source: https://github.com/containers/podman-compose/blob/main/CONTRIBUTING.md Commands to clone the repository, initialize a Python virtual environment, and install development dependencies. ```shell git clone https://github.com/USERNAME/podman-compose.git cd podman-compose python3 -m venv .venv . .venv/bin/activate pip install '.[devel]' pre-commit install ``` -------------------------------- ### Create volumes and start services with podman-compose Source: https://github.com/containers/podman-compose/blob/main/tests/integration/vol/README.md Use these commands to provision external volumes before launching the application stack. ```bash podman volume create my-app-data podman volume create actual-name-of-volume podman-compose up ``` -------------------------------- ### Basic docker-compose.yml with Full Features Source: https://context7.com/containers/podman-compose/llms.txt A comprehensive example of a docker-compose.yml file demonstrating various features like build contexts, image definitions, container naming, port mapping, environment variables, volume mounting, service dependencies with health checks, restart policies, and network configurations. This serves as a foundational example for defining multi-container applications. ```yaml version: "3" services: web: build: context: ./web dockerfile: Dockerfile args: - BUILD_ENV=production image: myapp-web:latest container_name: myapp-web ports: - "8080:80" environment: - DATABASE_URL=postgresql://db:5432/myapp - REDIS_URL=redis://redis:6379 env_file: - .env volumes: - ./app:/app - static_data:/app/static depends_on: db: condition: service_healthy redis: condition: service_started healthcheck: test: ["CMD", "curl", "-f", "http://localhost/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s restart: unless-stopped networks: - frontend - backend db: image: postgres:15 volumes: - db_data:/var/lib/postgresql/data environment: POSTGRES_DB: myapp POSTGRES_USER: myapp POSTGRES_PASSWORD: secret healthcheck: test: ["CMD-SHELL", "pg_isready -U myapp"] interval: 10s timeout: 5s retries: 5 networks: - backend redis: image: redis:alpine command: redis-server --appendonly yes volumes: - redis_data:/data networks: - backend volumes: static_data: db_data: redis_data: networks: frontend: backend: internal: true ``` -------------------------------- ### Run GCR Hello App with Podman-Compose Source: https://github.com/containers/podman-compose/blob/main/examples/hello-app/README.md Use this command to start the application. After execution, access the app at http://localhost:8080/. ```bash podman-compose up ``` -------------------------------- ### Service Dependencies and Health Checks in docker-compose.yml Source: https://context7.com/containers/podman-compose/llms.txt This example focuses on configuring service dependencies and health checks within a docker-compose.yml file. It shows how to define the startup order of services using 'depends_on' with specific conditions (e.g., 'service_healthy', 'service_started', 'service_completed_successfully') and how to implement health checks for services using 'healthcheck'. This ensures that services are available and ready before dependent services start, improving application stability. ```yaml version: "3" services: web: image: myapp:latest depends_on: db: condition: service_healthy redis: condition: service_started migration: condition: service_completed_successfully db: image: postgres:15 healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 5s timeout: 5s retries: 5 start_period: 10s redis: image: redis:alpine healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 3 migration: image: myapp:latest command: python manage.py migrate depends_on: db: condition: service_healthy ``` -------------------------------- ### Execute podman-compose lifecycle commands Source: https://github.com/containers/podman-compose/blob/main/tests/integration/additional_contexts/README.md Standard commands for building, starting, and stopping containers using podman-compose. ```bash podman-compose build podman-compose up podman-compose down ``` -------------------------------- ### Using Profiles with podman-compose CLI Source: https://context7.com/containers/podman-compose/llms.txt This section provides command-line examples for managing services using profiles with the podman-compose tool. It demonstrates how to activate single or multiple profiles during service startup, override profile settings using environment variables, and specify custom environment files. These commands are essential for controlling which services are deployed based on the environment or desired configuration. ```bash # Use profiles podman-compose --profile debug up -d podman-compose --profile test --profile ci up -d # Set via environment variable COMPOSE_PROFILES=debug,test podman-compose up -d # Override with .env file echo "VERSION=2.0.0" > .env echo "HOST_PORT=9000" >> .env podman-compose up -d # Or specify custom env file podman-compose --env-file production.env up -d ``` -------------------------------- ### Deploy and Test Redis Counter Source: https://github.com/containers/podman-compose/blob/main/examples/hello-python/README.md Use these commands to start the containerized service and verify the endpoints. ```bash podman-compose up -d curl localhost:8080/ curl localhost:8080/hello.json ``` -------------------------------- ### Manual Installation of Podman Compose Source: https://github.com/containers/podman-compose/blob/main/README.md Manually installs the podman-compose script by downloading it to a specified binary directory and making it executable. This can be done globally or within a user's home directory. ```bash # Global installation: curl -o /usr/local/bin/podman-compose https://raw.githubusercontent.com/containers/podman-compose/main/podman_compose.py chmod +x /usr/local/bin/podman-compose # User-specific installation: curl -o ~/.local/bin/podman-compose https://raw.githubusercontent.com/containers/podman-compose/main/podman_compose.py chmod +x ~/.local/bin/podman-compose ``` -------------------------------- ### Configure and Deploy AWX with Podman Compose Source: https://github.com/containers/podman-compose/blob/main/examples/awx17/README.md This snippet demonstrates the complete process of deploying AWX using Podman Compose. It includes setting up the environment, configuring Ansible variables, modifying the docker-compose file, and starting the AWX services. ```bash mkdir deploy awx17 ansible localhost \ -e host_port=8080 \ -e awx_secret_key='awx,secret.123' \ -e secret_key='awx,secret.123' \ -e admin_user='admin' \ -e admin_password='admin' \ -e pg_password='awx,123.' \ -e pg_username='awx' \ -e pg_database='awx' \ -e pg_port='5432' \ -e redis_image="docker.io/library/redis:6-alpine" \ -e postgres_data_dir="./data/pg" \ -e compose_start_containers=false \ -e dockerhub_base='docker.io/ansible' \ -e awx_image='docker.io/ansible/awx' \ -e awx_version='17.1.0' \ -e dockerhub_version='17.1.0' \ -e docker_deploy_base_path=$PWD/deploy \ -e docker_compose_dir=$PWD/awx17 \ -e awx_task_hostname=awx \ -e awx_web_hostname=awxweb \ -m include_role -a name=local_docker cp awx17/docker-compose.yml awx17/docker-compose.yml.orig sed -i -re "s#- \"$PWD/awx17/(.*):/#- \"./\1:/#" awx17/docker-compose.yml cd awx17 podman-compose run --rm --service-ports task awx-manage migrate --no-input podman-compose up -d ``` -------------------------------- ### Environment Variables and Profiles in docker-compose.yml Source: https://context7.com/containers/podman-compose/llms.txt This example illustrates how to use environment variables for dynamic configuration and profiles for selective service startup in a docker-compose.yml file. It shows interpolation of variables with default values, mandatory variables, and how to activate specific services using the 'profiles' key. This approach enhances flexibility and allows for different deployment scenarios. ```yaml version: "3" services: web: image: ${REGISTRY:-docker.io}/myapp:${VERSION:-latest} ports: - "${HOST_PORT:-8080}:${CONTAINER_PORT:-80}" environment: # Reference environment variable - API_KEY=${API_KEY} # With default value - LOG_LEVEL=${LOG_LEVEL:-info} # Error if not set - DATABASE_URL=${DATABASE_URL:?DATABASE_URL must be set} debug: image: busybox command: sleep infinity # Only start with 'debug' profile profiles: - debug test: image: myapp-test profiles: - test - ci ``` -------------------------------- ### Manage Multi-File and Service Inheritance Source: https://context7.com/containers/podman-compose/llms.txt Demonstrates how to merge multiple compose files for environment-specific overrides and how to use the 'extends' keyword for service inheritance. This approach promotes DRY (Don't Repeat Yourself) principles in complex container orchestration setups. ```bash podman-compose -f docker-compose.yml -f docker-compose.override.yml up -d podman-compose -f docker-compose.yml -f docker-compose.prod.yml up -d ``` ```yaml version: "3" services: web: extends: file: base.yml service: base-web ports: - "8080:80" ``` -------------------------------- ### Install Podman Compose using Pip Source: https://github.com/containers/podman-compose/blob/main/README.md Installs the latest stable version of podman-compose from PyPI. The `--user` flag can be used for installation within a user's home directory without root privileges. ```bash pip3 install podman-compose # For user-specific installation: pip3 install --user podman-compose ``` -------------------------------- ### Install Latest Development Version of Podman Compose Source: https://github.com/containers/podman-compose/blob/main/README.md Installs the latest development version of podman-compose directly from its GitHub repository. ```bash pip3 install https://github.com/containers/podman-compose/archive/main.tar.gz ``` -------------------------------- ### Install Podman Compose via Homebrew Source: https://github.com/containers/podman-compose/blob/main/README.md Installs podman-compose using the Homebrew package manager. ```bash brew install podman-compose ``` -------------------------------- ### Podman Extensions for docker-compose.yml Source: https://context7.com/containers/podman-compose/llms.txt This example demonstrates how to leverage Podman-specific features using the 'x-podman' extension keys within a docker-compose.yml file. It includes configurations for compatibility mode, user namespace mapping (uidmaps, gidmaps), disabling host entries, custom network settings like interface names, DNS, and routes, and SELinux relabeling for secrets. These extensions allow for finer-grained control over container and network behavior in Podman. ```yaml # docker-compose.yml with Podman extensions version: "3" # Global x-podman settings x-podman: # Enable Docker Compose compatibility mode docker_compose_compat: true # Use hyphens instead of underscores in names name_separator_compat: true # Disable pod creation (required for userns_mode) in_pod: false # Custom pod arguments pod_args: ["--infra=false", "--share=", "--cpus=2"] services: app: image: myapp:latest # UID/GID mapping for rootless containers x-podman.uidmaps: - "0:1:999" - "1000:0:1" x-podman.gidmaps: - "0:1:999" - "1000:0:1" # Don't create /etc/hosts x-podman.no_hosts: true # Use external rootfs instead of image # x-podman.rootfs: "/path/to/rootfs" userns_mode: keep-id:uid=1000 networks: mynet: ipv4_address: "192.168.1.10" # Per-network MAC address mac_address: "02:aa:bb:cc:dd:ee" # Custom interface name x-podman.interface_name: "eth1" networks: mynet: driver: bridge # Disable DNS for this network x-podman.disable_dns: false # Custom DNS servers x-podman.dns: - "8.8.8.8" - "8.8.4.4" # Custom routes x-podman.routes: - "10.0.0.0/8,192.168.1.1" ipam: config: - subnet: "192.168.1.0/24" gateway: "192.168.1.1" secrets: mysecret: file: ./secrets/mysecret.txt # SELinux relabeling for secrets x-podman.relabel: Z ``` -------------------------------- ### Control container lifecycle with podman-compose Source: https://context7.com/containers/podman-compose/llms.txt Commands to start, stop, restart, pause, and unpause services. Includes options for custom timeouts and signal handling. ```bash podman-compose start podman-compose start web db podman-compose stop podman-compose stop -t 60 podman-compose restart podman-compose restart -t 30 web podman-compose pause podman-compose pause web podman-compose unpause podman-compose unpause web podman-compose kill --all podman-compose kill web api podman-compose kill -s SIGTERM web podman-compose kill -s SIGHUP nginx ``` -------------------------------- ### Install Podman Compose via Debian Package Repository Source: https://github.com/containers/podman-compose/blob/main/README.md Installs podman-compose using the apt package manager on Debian-based systems. ```bash sudo apt install podman-compose ``` -------------------------------- ### Build and upload distribution artifacts Source: https://github.com/containers/podman-compose/blob/main/RELEASING.md Cleans previous build artifacts, builds the package using the Python build module, and uploads the resulting distribution files to PyPI using twine. Requires the twine package to be installed. ```bash rm -rf build dist python3 -m build python3 -m twine upload dist/* ``` -------------------------------- ### Install Podman Compose via Fedora Package Repository Source: https://github.com/containers/podman-compose/blob/main/README.md Installs podman-compose using the dnf package manager on Fedora systems. ```bash sudo dnf install podman-compose ``` -------------------------------- ### Deploy Azure Vote Application with Podman Compose Source: https://github.com/containers/podman-compose/blob/main/examples/azure-vote/README.md Sets the host port environment variable and initiates the container deployment. This command assumes a valid docker-compose.yml file exists in the current directory. ```bash echo "HOST_PORT=8080" > .env podman-compose up ``` -------------------------------- ### Configure and Run Podman Compose Source: https://github.com/containers/podman-compose/blob/main/examples/nodeproj/README.md Sets up environment files and executes the build and run commands for a Podman Compose project. ```bash cp example.local.env local.env cp example.env .env cat local.env cat .env echo "UID=$UID" >> .env cat .env podman-compose build podman-compose run --rm --no-deps init podman-compose up ``` -------------------------------- ### Integrate podman-compose with systemd Source: https://context7.com/containers/podman-compose/llms.txt Commands to create, register, and manage compose stacks as systemd services for automatic startup and background execution. ```bash sudo podman-compose systemd -a create-unit podman-compose systemd -a register podman-compose systemd -a unregister podman-compose systemd -a list systemctl --user enable --now 'podman-compose@myproject' systemctl --user status 'podman-compose@myproject' systemctl --user stop 'podman-compose@myproject' journalctl --user -xeu 'podman-compose@myproject' ``` -------------------------------- ### Execute Global CLI Options Source: https://context7.com/containers/podman-compose/llms.txt Provides a reference for common Podman Compose command-line flags, including project naming, file selection, environment variable loading, and debugging utilities. These options allow for granular control over the execution environment and Podman-specific runtime arguments. ```bash podman-compose -p myproject up -d podman-compose -f /path/to/docker-compose.yml up -d podman-compose --env-file production.env up -d podman-compose --verbose up -d podman-compose --podman-args="--log-level=debug" up -d podman-compose --parallel 4 up -d ``` -------------------------------- ### Validate configuration and monitor resources Source: https://context7.com/containers/podman-compose/llms.txt Commands to display the resolved compose configuration and monitor live resource usage statistics for services. ```bash podman-compose config podman-compose config --services podman-compose config -q podman-compose config --no-normalize podman-compose stats podman-compose stats web db podman-compose stats --no-stream podman-compose stats --interval 10 podman-compose stats --no-reset podman-compose stats --format "{{.Name}}: {{.CPUPerc}}" ``` -------------------------------- ### List and inspect containers with podman-compose Source: https://context7.com/containers/podman-compose/llms.txt Commands to list container status and inspect images. Allows for quiet mode and custom output formatting. ```bash podman-compose ps podman-compose ps -q podman-compose ps --format "{{.Names}} {{.Status}}" podman-compose images podman-compose images -q ``` -------------------------------- ### Generate Podman Compose Binary using Docker/Podman Source: https://github.com/containers/podman-compose/blob/main/README.md Downloads the podman-compose repository, builds a binary using the provided Dockerfile, and places the executable in the current directory. ```bash sh -c "$(curl -sSL https://raw.githubusercontent.com/containers/podman-compose/main/scripts/download_and_build_podman-compose.sh)" ``` -------------------------------- ### Run project test suite Source: https://github.com/containers/podman-compose/blob/main/CONTRIBUTING.md Executes linting, type checking, and unit/integration tests to ensure code quality and functionality. Requires ruff, mypy, pylint, and the unittest framework. ```shell ruff format ruff check --fix mypy . pylint podman_compose.py python -m unittest discover tests/unit python -m unittest discover -v tests/integration ``` -------------------------------- ### Manage container images with podman-compose Source: https://context7.com/containers/podman-compose/llms.txt Commands to pull images from registries or push local builds. Supports targeting specific services and forcing local updates. ```bash podman-compose pull podman-compose pull web db podman-compose pull --force-local podman-compose push podman-compose push web api ``` -------------------------------- ### Manage container logs with podman-compose Source: https://context7.com/containers/podman-compose/llms.txt Commands to view, follow, and filter logs from services. Supports timestamps, tailing, and time-based filtering. ```bash podman-compose logs podman-compose logs -f podman-compose logs web db podman-compose logs -t podman-compose logs --tail=100 podman-compose logs --since="2024-01-01T00:00:00" podman-compose logs --until="1h" podman-compose logs -f -t --tail=50 web podman-compose logs --no-color podman-compose logs -n ``` -------------------------------- ### Perform release tagging and push Source: https://github.com/containers/podman-compose/blob/main/RELEASING.md Executes the release script to create a version commit, apply a git tag, and push the changes to the remote repository. This step assumes the release notes PR has been merged. ```bash ./scripts/make_release.sh $VERSION ``` -------------------------------- ### Initialize release version variable Source: https://github.com/containers/podman-compose/blob/main/RELEASING.md Sets the target version for the release process as an environment variable. This variable is used by subsequent scripts to ensure consistency across release steps. ```bash export VERSION=1.2.3 ``` -------------------------------- ### Generate release notes Source: https://github.com/containers/podman-compose/blob/main/RELEASING.md Executes the release notes script which utilizes the towncrier tool to aggregate news fragments. This process should be performed in a dedicated branch to allow for CI validation. ```bash ./scripts/make_release_notes.sh $VERSION ``` -------------------------------- ### Run Podman Compose Integration Tests Source: https://github.com/containers/podman-compose/blob/main/README.md Executes the integration tests for podman-compose using Python's unittest module. ```shell python3 -m unittest discover tests/integration ``` -------------------------------- ### Run Podman Compose Unit Tests Source: https://github.com/containers/podman-compose/blob/main/README.md Executes the unit tests for podman-compose using Python's unittest module. ```shell python3 -m unittest discover tests/unit ``` -------------------------------- ### Test Echo Service with Curl Source: https://github.com/containers/podman-compose/blob/main/examples/echo/README.md Send a POST request with data to the echo service and display the server's response, including client and server values, headers, and the body. ```bash $ curl -X POST -d "foobar" http://localhost:8080/; echo CLIENT VALUES: client_address=10.89.31.2 command=POST real path=/ query=nil request_version=1.1 request_uri=http://localhost:8080/ SERVER VALUES: server_version=nginx: 1.10.0 - lua: 10001 HEADERS RECEIVED: accept=*/* content-length=6 content-type=application/x-www-form-urlencoded host=localhost:8080 user-agent=curl/7.76.1 BODY: foobar ``` -------------------------------- ### Query port mappings with podman-compose Source: https://context7.com/containers/podman-compose/llms.txt Commands to retrieve the host port mapped to a specific container port, including support for protocols and scaled instances. ```bash podman-compose port web 80 podman-compose port --protocol udp web 53 podman-compose port --index=2 web 80 ``` -------------------------------- ### Invoke command from another command Source: https://github.com/containers/podman-compose/blob/main/CONTRIBUTING.md Demonstrates how to programmatically trigger one registered command from within another command function. ```python @cmd_run(podman_compose, 'up', 'up desc') async def compose_up(compose, args): await compose.commands['down'](compose, args) # or await compose.commands['down'](argparse.Namespace(foo=123)) ``` -------------------------------- ### Configure Volume and Mount Types in YAML Source: https://context7.com/containers/podman-compose/llms.txt Defines various volume mounting strategies including named volumes, bind mounts, anonymous volumes, tmpfs, and Podman-specific glob mounts. This configuration is used within the services section of a docker-compose.yml file to manage persistent storage and host-container file synchronization. ```yaml version: "3" services: app: image: myapp:latest volumes: - app_data:/app/data - ./src:/app/src - /etc/timezone:/etc/timezone:ro - /app/temp - type: tmpfs target: /app/cache tmpfs: size: 100m mode: 1777 - type: bind source: ./config target: /app/config read_only: true bind: propagation: rprivate selinux: z - type: glob source: ./configs/*.conf target: /etc/myapp/conf.d/ volumes: app_data: driver: local driver_opts: type: none device: /data/myapp o: bind external_volume: external: true name: shared_data ``` -------------------------------- ### Enable All Docker Compose Compatibility Settings in Podman-Compose Source: https://github.com/containers/podman-compose/blob/main/docs/Extensions.md This configuration enables all compatibility settings for Podman-Compose to align with Docker Compose behavior. It can be set within the 'x-podman' key in your compose file or via the PODMAN_COMPOSE_DOCKER_COMPOSE_COMPAT environment variable. ```yaml x-podman: docker_compose_compat: true ``` -------------------------------- ### Configure Default Network Behavior Compatibility in Podman-Compose Source: https://github.com/containers/podman-compose/blob/main/docs/Extensions.md This setting aligns Podman-Compose's default network behavior with Docker Compose when no specific network is defined for a service. Enable this via the 'x-podman' key or the PODMAN_COMPOSE_DEFAULT_NET_BEHAVIOR_COMPAT environment variable. ```yaml x-podman: default_net_behavior_compat: true ``` -------------------------------- ### Define expected data output format Source: https://github.com/containers/podman-compose/blob/main/tests/integration/additional_contexts/README.md Format specification for dictionary and list data structures. ```text [dict] | Data for dict [list] | Data for list ``` -------------------------------- ### Podman Compose: Container RootFS Configuration Source: https://github.com/containers/podman-compose/blob/main/docs/Extensions.md Allows running a Podman container with an externally managed root filesystem. This is useful when the container's rootfs is prepared independently of image management. It requires specifying the path to the rootfs. ```yaml version: "3" services: my_service: command: ["/bin/busybox"] x-podman.rootfs: "/path/to/rootfs" ``` -------------------------------- ### Define new CLI command Source: https://github.com/containers/podman-compose/blob/main/CONTRIBUTING.md Registers a new command using the @cmd_run decorator. The function must be asynchronous and accept the compose instance and argparse arguments. ```python @cmd_run(podman_compose, 'build', 'build images defined in the stack') async def compose_build(compose, args): await compose.podman.run(['build', 'something']) ``` -------------------------------- ### Configure Name Separator Compatibility in Podman-Compose Source: https://github.com/containers/podman-compose/blob/main/docs/Extensions.md This setting allows Podman-Compose to use hyphens (-) as name separators, matching Docker Compose's behavior. By default, Podman-Compose uses underscores (_). Enable this via the 'x-podman' key or the PODMAN_COMPOSE_NAME_SEPARATOR_COMPAT environment variable. ```yaml x-podman: name_separator_compat: true ``` -------------------------------- ### Configure Default Network Name Compatibility in Podman-Compose Source: https://github.com/containers/podman-compose/blob/main/docs/Extensions.md This setting ensures that Podman-Compose generates default external network names consistent with Docker Compose, which removes dashes from project names. Enable this via the 'x-podman' key or the PODMAN_COMPOSE_DEFAULT_NET_NAME_COMPAT environment variable. ```yaml x-podman: default_net_name_compat: true ``` -------------------------------- ### Override Pod Creation Arguments in Podman-Compose Source: https://github.com/containers/podman-compose/blob/main/docs/Extensions.md This configuration allows overriding the default arguments used for pod creation when '--pod-args' is not specified on the command line. Define custom arguments within the 'pod_args' list under the 'x-podman' key. This can also be set via the PODMAN_COMPOSE_POD_ARGS environment variable. ```yaml x-podman: pod_args: ["--infra=false", "--share=", "--cpus=1"] ``` -------------------------------- ### Define command arguments Source: https://github.com/containers/podman-compose/blob/main/CONTRIBUTING.md Registers command-line arguments for a specific command using the @cmd_parse decorator. It utilizes the standard argparse library to define flags and options. ```python @cmd_parse(podman_compose, 'build') def compose_build_parse(parser): parser.add_argument("--pull", help="attempt to pull a newer version of the image", action='store_true') parser.add_argument("--pull-always", help="Attempt to pull a newer version of the image, " "raise an error even if the image is present locally.", action='store_true') ``` -------------------------------- ### Podman Compose: Network Route Configuration Source: https://github.com/containers/podman-compose/blob/main/docs/Extensions.md Adds custom routes to a Podman network, enabling specific network paths for containers. This allows for fine-grained control over network connectivity, such as blocking access to certain subnets. The format for routes corresponds to the `podman network create --route` option. ```yaml version: "3" network: my_network: x-podman.routes: - "10.2.3.4,127.0.0.1" ``` -------------------------------- ### Podman Compose: Advanced Network Modes Source: https://github.com/containers/podman-compose/blob/main/docs/Extensions.md Enables the use of Podman-specific network modes beyond the standard Docker options. These include `slirp4netns`, `ns`, `pasta`, and `private`, which offer advanced networking capabilities and can accept options passed directly to `podman create --network`. ```yaml services: app: image: "alpine" network-mode: "slirp4netns:allow_host_loopback=true,outbound_addr=192.168.1.2" db: image: "postgres" network-mode: "private" ``` -------------------------------- ### Podman Compose: Per-Network MAC Address Assignment Source: https://github.com/containers/podman-compose/blob/main/docs/Extensions.md Assigns a specific MAC address to a network interface within a container for a particular network. This allows for precise control over network identification. The `x-podman.mac_address` is supported for backward compatibility, while the standard `mac_address` is recommended. ```yaml --- version: "3" networks: net0: driver: "bridge" ipam: config: - subnet: "192.168.0.0/24" net1: driver: "bridge" ipam: config: - subnet: "192.168.1.0/24" services: webserver: image: "busybox" command: ["/bin/busybox", "httpd", "-f", "-h", "/etc", "-p", "8001"] networks: net0: ipv4_address: "192.168.0.10" x-podman.mac_address: "02:aa:aa:aa:aa:aa" net1: ipv4_address: "192.168.1.10" mac_address: "02:bb:bb:bb:bb:bb" # mac_address is supported ``` -------------------------------- ### Podman Compose: Per-Network Interface Naming Source: https://github.com/containers/podman-compose/blob/main/docs/Extensions.md Allows specifying the network interface name inside a container for a specific network connection. This provides control over how network interfaces are named within the container's network namespace. ```yaml services: my_service: image: "some_image" networks: my_network: x-podman.interface_name: "eth1" ``` -------------------------------- ### Manage Custom Pods with 'in_pod' in Podman-Compose Source: https://github.com/containers/podman-compose/blob/main/docs/Extensions.md This configuration allows control over whether containers are placed in pods using the 'in_pod' setting within the 'x-podman' key. This is particularly useful when combined with user namespace settings. It can also be set via the PODMAN_COMPOSE_IN_POD environment variable. ```yaml x-podman: in_pod: false ``` -------------------------------- ### Podman Compose: Network DNS Configuration Source: https://github.com/containers/podman-compose/blob/main/docs/Extensions.md Specifies custom nameservers for a Podman network, overriding the default DNS resolution. This configuration allows containers on the network to use the provided list of IP addresses for DNS queries. It cannot be used in conjunction with disabling the DNS plugin. ```yaml version: "3" network: my_network: x-podman.dns: - "10.1.2.3" - "10.1.2.4" ``` -------------------------------- ### Podman Compose: Secret SELinux Relabeling Source: https://github.com/containers/podman-compose/blob/main/docs/Extensions.md Configures SELinux relabeling for secrets in Podman-compose. The 'Z' value indicates that the volume content should be relabeled to match the container's security context, ensuring proper SELinux enforcement for private and unshared content. ```yaml secrets: custom-secret: x-podman.relabel: Z ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.