watchtower
watchtower copied to clipboard
too many network aliases when recreating the container

Hi there! 👋🏼 As you're new to this repo, we'd like to suggest that you read our code of conduct as well as our contribution guidelines. Thanks a bunch for opening your first issue! 🙏
Hi,
Would you mind expanding on what the issue is and when it occurs?
Thanks, Simme
The issue IMHO is that a lot of aliases are accumulating over time (one additional alias per recreate). These are just the container IDs of former instances of this Docker container, which most probably do not serve any purpose, so they could be filtered out when recreating the container.
It seems like code from #1699 removes necessary labels added by docker compose. Before restarting:
"Networks": {
"cartman": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"backend",
"4fcb8f2cd0cf"
],
"NetworkID": "436b4634c942dc7ed8dbc91264b2902f963835297b8e79de174a303c3e512efe",
"EndpointID": "20200dd70ca0b2d4c78e7382d1fd532b42b3d75d0591aacdc271d01c42c5a812",
After restarting:
"Networks": {
"cartman": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"8a165377fbb4"
],
"NetworkID": "436b4634c942dc7ed8dbc91264b2902f963835297b8e79de174a303c3e512efe",
"EndpointID": "e04e0ed1ef91c9c98c1b793172a8983e131d196ad13d1e8ec46b4b8affb61398",
Docker compose added service name backend to container's aliases, but after restarting it's not available anymore.
That was an oversight, yeah. I think we can deduce from labels what networks are "actual" aliases. A regex could potentially match a valid real alias name...