mirror of https://github.com/docker/compose.git
Restore container ID alias
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
e78c0bf533
commit
07199fac37
|
@ -583,11 +583,7 @@ class Service(object):
|
|||
continue
|
||||
self.client.disconnect_container_from_network(container.id, network)
|
||||
|
||||
self.client.disconnect_container_from_network(
|
||||
container.id,
|
||||
network)
|
||||
|
||||
aliases = self._get_aliases(netdefs) if use_network_aliases else []
|
||||
aliases = self._get_aliases(netdefs, container) if use_network_aliases else []
|
||||
|
||||
self.client.connect_container_to_network(
|
||||
container.id, network,
|
||||
|
@ -696,8 +692,12 @@ class Service(object):
|
|||
numbers = [c.number for c in containers]
|
||||
return 1 if not numbers else max(numbers) + 1
|
||||
|
||||
def _get_aliases(self, network):
|
||||
return list({self.name} | set(network.get('aliases', ())))
|
||||
def _get_aliases(self, network, container=None):
|
||||
return list(
|
||||
{self.name} |
|
||||
({container.short_id} if container else set()) |
|
||||
set(network.get('aliases', ()))
|
||||
)
|
||||
|
||||
def build_default_networking_config(self):
|
||||
if not self.networks:
|
||||
|
|
Loading…
Reference in New Issue