FIXES #15: respect container_name

This commit is contained in:
alsadi 2019-05-14 15:14:47 +03:00
parent 5f7e46dbbe
commit 882cef73b7

View File

@ -497,11 +497,15 @@ def run_compose(
replicas = try_int(service_desc.get('deploy', {}).get('replicas', '1')) replicas = try_int(service_desc.get('deploy', {}).get('replicas', '1'))
container_names_by_service[service_name] = [] container_names_by_service[service_name] = []
for num in range(1, replicas+1): for num in range(1, replicas+1):
name = "{project_name}_{service_name}_{num}".format( name0 = "{project_name}_{service_name}_{num}".format(
project_name=project_name, project_name=project_name,
service_name=service_name, service_name=service_name,
num=num, num=num,
) )
if num == 1:
name = service_desc.get("container_name", name0)
else:
name = name0
container_names_by_service[service_name].append(name) container_names_by_service[service_name].append(name)
# print(service_name,service_desc) # print(service_name,service_desc)
cnt = dict(name=name, num=num, cnt = dict(name=name, num=num,