Jump to content

Docker network alias


Knutowskie

Recommended Posts

Posted

I got the following setup:

SWAG, 2x Nextcloud, MariaDB and Collabora are running in docker containers. All fine so far.

 

I noticed that the containers Nextcloud and Collabora are talking with each other over the WAN Loop. The solution for speeding things up should be to set up docker network aliases ( see here: https://help.nextcloud.com/t/probably-dns-help-with-nc-docker-collabora-wireguard-tunnel/176562/5 )

 

My problem is: where in the Web-GUI of unraid i can set up this?

 

My search attempts here didnt reveal another threat. So maybe someone got a solution?

Posted

Unraids Web UI has no build in function do configure Docker Networks. Unraid automatically creates a new docker network for bonded interfaces and has the flag to preserve Docker Networks on restart (though it still can fail). If you need to add some additional network configuration, you will have to use the CLI.

 

After the network is created, you can normally select in the Dropdown on editing the template.

 

A lot of people edit the Template and add something along the line of && docker network blah for the Post Argument to have the configuration persistent.

  • Thanks 1
Posted (edited)
On 9/23/2024 at 11:42 PM, Bastian said:

Unraids Web UI has no build in function do configure Docker Networks. Unraid automatically creates a new docker network for bonded interfaces and has the flag to preserve Docker Networks on restart (though it still can fail). If you need to add some additional network configuration, you will have to use the CLI.

 

After the network is created, you can normally select in the Dropdown on editing the template.

 

A lot of people edit the Template and add something along the line of && docker network blah for the Post Argument to have the configuration persistent.

Thank you for your reply.

So where can i add the network aliases for my swag container? It needs to be something like cloud.domain.com and collabora.domain.com so the internal traffic stays internal. In the situation right now the nextcloud container talks to collabora container over WAN, as it is only able to use "collabora.domain.com" and no IP address. 

 

To be honest: i don't know which dropdown you mean where i can add the line for the alias.

It should look like this:

 

docker network connect --alias cloud.domain.com --alias collabora.domain.com somedockernetwork swag

 

But this would connect it to another network as far as i understand. I only need the swag to be connected to one single docker net, but with aliases.

Is there a docker-compose file or something, that unraid uses and that i can edit?

The other solution would be to connect swag to a dummy network in default and then add the real network with the solution i found here: using_multiple_docker_networks_in_unraid

Edited by Knutowskie
Posted

For better or worse, Lime Tech created their own Compose Notation to store the Run Configuration. Those are stored within /boot/config/plugins/dockerMan/templates-user.

 

The way I would go with it (though never done it myself):

  1. Enable "Preserve Docker Networks" in the Docker Configuration in Unraid
  2. Create a new Docker Network using the CLI
    1. docker network create somedockernetwork
  3. Edit Swag and attach it to said network using the UI
    1. The network is available from the dropdown list in the UI
  4. Edit Swag and create the alias using the "Post Argument" (Advanced View)
    1. && docker network connect --alias cloud.domain.com --alias collabora.domain.com somedockernetwork swag
  • Thanks 1
Posted (edited)
23 hours ago, Bastian said:

For better or worse, Lime Tech created their own Compose Notation to store the Run Configuration. Those are stored within /boot/config/plugins/dockerMan/templates-user.

 

The way I would go with it (though never done it myself):

  1. Enable "Preserve Docker Networks" in the Docker Configuration in Unraid
  2. Create a new Docker Network using the CLI
    1. docker network create somedockernetwork
  3. Edit Swag and attach it to said network using the UI
    1. The network is available from the dropdown list in the UI
  4. Edit Swag and create the alias using the "Post Argument" (Advanced View)
    1. && docker network connect --alias cloud.domain.com --alias collabora.domain.com somedockernetwork swag

but if i want to connect a docker container to the same network twice, i get an error. "The command failed."

 

...
Error response from daemon: endpoint with name swag already exists in network proxynet

 

So this is my solution that seems to work:

 

i created some custom network named "eth0" a while ago for my pihole. The swag container now is connected primary to it and gets an IP in my Home-LAN. Let's say 192.168.0.3.

With the above way i attached it to my "proxynet" where the 2 nextclouds, a mariaDB and the collabora lives.
image.thumb.png.36f6a30555d1251c6fe5470ab89b4c49.png
All seems to work!

Any suggestions why this may be a bad idea? 

Edited by Knutowskie

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...