Skip to content

Commit 00d0f69

Browse files
committed
Extend docker network name with generated suffix
1 parent 0054b79 commit 00d0f69

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Changed
1515
- Custom dump file names now follow the same naming rules as docker containers.
16+
- Add generated base64 suffix to network name to prevent duplicates with docker-compose
1617

1718
### Removed
1819
- Dropped Support for i386 Architecture

src/docker.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
22
import os
33
import docker
4+
import base64
45
from src import settings
56

67

@@ -47,7 +48,10 @@ def get_targets(self, label):
4748
)
4849

4950
def get_network_name(self):
50-
return f"{self._config.docker_network_name}_{self._config.instance_id}"
51+
encoded_instance_id = base64.b64encode(
52+
str.encode(self._config.instance_id)).decode("utf-8", "ignore")
53+
54+
return f"{self._config.docker_network_name}_{self._config.instance_id}-{encoded_instance_id[:10]}"
5155

5256
def cleanup_old_networks(self):
5357
network_name = self.get_network_name()

0 commit comments

Comments
 (0)