@@ -1676,6 +1676,7 @@ def __init__(self):
16761676 self .commands = {}
16771677 self .global_args = None
16781678 self .project_name = None
1679+ self .label_domain = None
16791680 self .dirname = None
16801681 self .pods = None
16811682 self .containers = None
@@ -1793,6 +1794,7 @@ def _parse_compose_file(self):
17931794 relative_files = files
17941795 filename = files [0 ]
17951796 project_name = args .project_name
1797+ label_domain = args .label_domain
17961798 # no_ansi = args.no_ansi
17971799 # no_cleanup = args.no_cleanup
17981800 # dry_run = args.dry_run
@@ -1894,6 +1896,7 @@ def _parse_compose_file(self):
18941896 raise RuntimeError (f"Project name [{ dir_basename } ] normalized to empty" )
18951897
18961898 self .project_name = project_name
1899+ self .label_domain = label_domain
18971900 self .environ .update ({"COMPOSE_PROJECT_NAME" : self .project_name })
18981901
18991902 services = compose .get ("services" , None )
@@ -1938,18 +1941,15 @@ def _parse_compose_file(self):
19381941 raise RuntimeError (f"missing networks: { missing_nets_str } " )
19391942 # volumes: [...]
19401943 self .vols = compose .get ("volumes" , {})
1941- podman_compose_labels = list (set ([
1942- compose .label_domain + ".config-hash=" + self .yaml_hash ,
1943- compose .label_domain + ".project=" + project_name ,
1944- compose .label_domain + ".version=" + __version__ ,
1945- "io.podman.compose.config-hash=" + self .yaml_hash ,
1946- "io.podman.compose.project=" + project_name ,
1947- "io.podman.compose.version=" + __version__ ,
1944+ podman_compose_labels = [
1945+ label_domain + ".config-hash=" + self .yaml_hash ,
1946+ label_domain + ".project=" + project_name ,
1947+ label_domain + ".version=" + __version__ ,
19481948 f"PODMAN_SYSTEMD_UNIT=podman-compose@{ project_name } .service" ,
19491949 "com.docker.compose.project=" + project_name ,
19501950 "com.docker.compose.project.working_dir=" + dirname ,
19511951 "com.docker.compose.project.config_files=" + "," .join (relative_files ),
1952- ]))
1952+ ]
19531953 # other top-levels:
19541954 # networks: {driver: ...}
19551955 # configs: {...}
@@ -2119,6 +2119,13 @@ def _init_global_parser(parser):
21192119 type = str ,
21202120 default = None ,
21212121 )
2122+ parser .add_argument (
2123+ "--label-domain" ,
2124+ help = "Specify an alternate root domain for resource labels (default: io.podman)" ,
2125+ type = str ,
2126+ metavar = "label_domain" ,
2127+ default = "io.podman" ,
2128+ )
21222129 parser .add_argument (
21232130 "--podman-path" ,
21242131 help = "Specify an alternate path to podman (default: use location in $PATH variable)" ,
@@ -2505,7 +2512,7 @@ async def compose_up(compose: PodmanCompose, args):
25052512 f"label={ compose .label_domain } .project={ compose .project_name } " ,
25062513 "-a" ,
25072514 "--format" ,
2508- '{{ index .Labels "' + compose .label_domain '.config-hash"}}' ,
2515+ '{{ index .Labels "' + compose .label_domain + '.config-hash"}}' ,
25092516 ],
25102517 )
25112518 )
0 commit comments