Guide to linking containers


Kosta

Recommended Posts

Hi,

 

I browsed tirelessly through the forums to try and find a way to link up containers that communicate with each other, but was disappointed to see that the preferred solution was dropping files into directories shared between containers. I wasn't satisfied with this approach and decided to find a way to link the containers so that data can be exchanged between them via network communication, like it should be. So without much further ado, here is a quick overview of how I linked up SickBeard container with NZBGet so that it can pass NZB files to it directly:

 

Forget the silly text, I used localhost instead of docker host's hostname, but here's a guide to linking containers either way :)

 

Step 1 - Add instruction to link SickBeard to NZBget in the unRAID webGUI

 

e0BRbc8.png

 

The command is

--link <container name to link with>:<alias>

Remember the alias because you will need it for...

 

Step 2 - Refer to the NZBGet container in SickBeard

 

When you perform the linking, docker will create some environment variables that specify which IP address was linked under, and what ports are available. In addition to this, it will also create a hostname in the container you created the link from, that maps alias from the --link command to the internal IP given to the container you linked to. This is probably best seen rather than explained:

 

root@Tower:/mnt# docker exec -i -t e0c4109fc635 bash
root@e0c4109fc635:/# cat /etc/hosts         
172.17.0.25	e0c4109fc635
ff02::2	ip6-allrouters
127.0.0.1	localhost
::1	localhost ip6-localhost ip6-loopback
fe00::0	ip6-localnet
ff00::0	ip6-mcastprefix
ff02::1	ip6-allnodes
172.17.0.11	nzbget

 

Note the last line! We can now use this to refer to the target container directly, like so:

RC7q40f.png

 

And voila! You're done.

 

It would be nice if there was some sort of a "helper" page in the webGUI to achieve this, but this approach isn't too bad.

Link to comment

Hi,

 

I browsed tirelessly through the forums to try and find a way to link up containers that communicate with each other, but was disappointed to see that the preferred solution was dropping files into directories shared between containers. I wasn't satisfied with this approach and decided to find a way to link the containers so that data can be exchanged between them via network communication, like it should be. So without much further ado, here is a quick overview of how I linked up SickBeard container with NZBGet so that it can pass NZB files to it directly:

 

Step 1 - Add instruction to link SickBeard to NZBget in the unRAID webGUI

 

e0BRbc8.png

 

The command is

--link <container name to link with>:<alias>

Remember the alias because you will need it for...

 

Step 2 - Refer to the NZBGet container in SickBeard

 

When you perform the linking, docker will create some environment variables that specify which IP address was linked under, and what ports are available. In addition to this, it will also create a hostname in the container you created the link from, that maps alias from the --link command to the internal IP given to the container you linked to. This is probably best seen rather than explained:

 

root@Tower:/mnt# docker exec -i -t e0c4109fc635 bash
root@e0c4109fc635:/# cat /etc/hosts         
172.17.0.25	e0c4109fc635
ff02::2	ip6-allrouters
127.0.0.1	localhost
::1	localhost ip6-localhost ip6-loopback
fe00::0	ip6-localnet
ff00::0	ip6-mcastprefix
ff02::1	ip6-allnodes
172.17.0.11	nzbget

 

Note the last line! We can now use this to refer to the target container directly, like so:

RC7q40f.png

 

And voila! You're done.

 

It would be nice if there was some sort of a "helper" page in the webGUI to achieve this, but this approach isn't too bad.

 

This is really neat and I didnt' know you could do that... curious what is the benefit of doing this over IPADDRESSOFUNRAID:6789 in the NZBGET URL

  • Upvote 1
Link to comment

Funny thing, I was unable to get connectivity with the unRAID host ports from the sickbeard docker container, but now I went back and tried it again just to double check... and what do you know... I can reach NZBGet through the host port without any linking  :D

 

EDIT: I used localhost instead of tower as the hostname from SickBeard. Yep, I'm an idiot. Ah well, in case you'll want to link up containers directly for some OTHER reason than stupidity, now you know how. :)

Link to comment

Funny thing, I was unable to get connectivity with the unRAID host ports from the sickbeard docker container, but now I went back and tried it again just to double check... and what do you know... I can reach NZBGet through the host port without any linking  :D

 

EDIT: I used localhost instead of tower as the hostname from SickBeard. Yep, I'm an idiot. Ah well, in case you'll want to link up containers directly for some OTHER reason than stupidity, now you know how. :)

 

I'm glad you found out how to do it :)

Link to comment
  • 2 years later...

 

Maybe this is a dumb question but.....

 

Can you link two containers? 

  1. I have linked Sonarr and NZBGet and it works fine - score!
  2. I also use "Hydra" and would like to link Sonarr and Hydra (at least I think this would be nice?)

I tried both "--link hydra:hydra --link NZBGet:nzbget" and "--link NZBGet:nzbget hydra:hydra " but neither seems to work?

 

And perhaps you are only meant to link one container to one container? 

 

Thanks!

Link to comment
  • 2 years later...

Not sure if this is still something that you need. I just found (Unraid 6.6.7) that if you select the 'advanced view' (change the toggle that normally says 'basic view' on the top right); you then have the option of 'Extra Parameters. This is where I was able to add the --link <container-name>.

 

965283270_ScreenShot2019-06-06at2_15_55pm.thumb.png.3106557ea2f91e54b0e25f8f8b4244d8.png

Link to comment

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.