[Feature Request] Service level network name (default alias)

I would like to have the possibility to overwrite the default alias of a service on network level to avoid duplicates in external networks.

This could look like:

        name: my-db-to-override-db-default-alias
          - db_123_213

if you would inspect the service it should no longer be aliased as db

"Networks": {
  "my_network": {
    "Aliases": [

One use case would be if I have an external proxy network and several docker compose projects which each have a service X (e.g. app or pgsql). sometimes it would be useful to change the default alias for the external network to avoid a conflict.

I don’t see how this would add any value to the existing solution, but if you feel this is a missing feature, you should consider creating an issue with a feature request in the Moby Github Repository:

I will open the request there if that is the better place for it.

The value for me is that I can deploy projects from different colleagues even if they share a network. The colleagues can then continue to specify the service name as the database url (via default docker compose network), but I can make sure that there are not two alliases for mariadb in my network.
I hope this description makes sense. Perhaps a workaround already exists, if you have an idea please let me know.