Hi All,
I'm trying to get my docker containers to talk to one another without using their IP addresses (they change when restarting sometimes) and without using links (since this has or will be taken away soon).
For reference I'm using TS-453Bmini with linuxserver nzbget, sonarr, radarr containers.
Using NAT and then exposing internal container ports to external ones.
I've set the hostname for nzbget to nzbget and put that in the hostname but it won't connect.
Anyone have any ideas as to why?
Thanks!
AshranPewter
Using Default NAT can't resolve hostnames
-
- New here
- Posts: 4
- Joined: Sat Dec 29, 2018 1:33 pm
-
- New here
- Posts: 4
- Joined: Sat Dec 29, 2018 1:33 pm
Re: Using Default NAT can't resolve hostnames
Just thought I'd let you know of a solution to this.
I installed Portainer according to this reddit post:
Note that the tabs are important since the file is yaml (docker-compose.yaml)
Using docker-compose (or within portainer, stacks) lets you create a set of images that then can talk to another easily because it automatically creates a user-defined bridge network that has a DNS server incorporated into it and also deploys all of these images automatically. So now I can just type in 'nzbget' into the hostname and it works. The ${DATA}, ${CONFIG} etc are Environment variables (env), they allow me to change the location of the files when I want easily, DATA stores the data files, CONFIG is appdata, DOWNLOAD is where the downloads go, PUID/PGID are user id and group id, explained in the post above and are something that linuxserver images have to allow for images to not have admin issues with folders/files.
There is something called watchtower that I don't use that would update images automatically, I think this is bad practice without a backup because an updated image could break your configs due to not updating properly.
You could also add in torrenting into this pretty easily following the template and the original template is based off of https://github.com/duhio/docker-compose-usenet which uses sabnzbd (which is python based vs nzbget which is c++). This also has the ability to create a reverse proxy so you can do things like sonarr.hostname.com, but I don't have a domain setup yet and don't really need one.
Hope this helps someone.
I installed Portainer according to this reddit post:
I would follow this guide for some good recommendations on how to setup Docker apps on QNAP.
https://www.linuxserver.io/2017/09/17/h ... s-on-qnap/
Then for Portainer install I use the following command line:
docker run -d -p 9000:9000 --name=portainer \
--net=host --restart on-failure \
-e PUID=<your docker user UID> \
-e PGID=<your docker user GUID> \
-v /share/<your docker data diretory>/portainer:/data \
-v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
Code: Select all
---
version: '2'
services:
nzbget:
image: linuxserver/nzbget:latest
container_name: nzbget
hostname: nzbget
ports:
- "6789:6789"
environment:
PUID: ${PUID}
PGID: ${PGID}
volumes:
- ${CONFIG}/nzbget:/config
- ${DOWNLOAD}/complete:/downloads
- ${DOWNLOAD}/incomplete:/incomplete-downloads
- ${DOWNLOAD}/watch:/watch
restart: unless-stopped
sonarr:
image: linuxserver/sonarr:latest
container_name: sonarr
hostname: sonarr
ports:
- "8989:8989"
environment:
PUID: ${PUID}
PGID: ${PGID}
volumes:
- ${CONFIG}/sonarr:/config
- ${DOWNLOAD}/complete:/downloads
- ${DATA}/tv:/tv
- ${DATA}/anime:/anime
restart: unless-stopped
radarr:
image: linuxserver/radarr:latest
container_name: radarr
hostname: radarr
ports:
- "7878:7878"
environment:
PUID: ${PUID}
PGID: ${PGID}
volumes:
- ${CONFIG}/radarr:/config
- ${DOWNLOAD}/complete:/downloads
- ${DATA}/movies:/movies
restart: unless-stopped
lidarr:
image: linuxserver/lidarr:latest
container_name: lidarr
hostname: lidarr
ports:
- "8686:8686"
environment:
PUID: ${PUID}
PGID: ${PGID}
volumes:
- ${CONFIG}/lidarr:/config
- /etc/localtime:/etc/localtime:ro
- ${DOWNLOAD}/complete:/downloads
- ${DATA}/music:/music
restart: unless-stopped
mylar:
image: linuxserver/mylar:latest
container_name: mylar
hostname: mylar
ports:
- "8090:8090"
environment:
PUID: ${PUID}
PGID: ${PGID}
volumes:
- ${CONFIG}/mylar:/config
- ${DOWNLOAD}/complete:/downloads
- ${DATA}/comics:/comics
restart: unless-stopped
nzbhydra:
image: linuxserver/hydra2:latest
container_name: nzbhydra
hostname: nzbhydra
ports:
- "5076:5076"
environment:
PUID: ${PUID}
PGID: ${PGID}
volumes:
- ${CONFIG}/nzbhydra2:/config
- ${DOWNLOAD}/complete:/downloads
restart: unless-stopped
ombi:
image: linuxserver/ombi
container_name: ombi
hostname: ombi
ports:
- "3579:3579"
environment:
PUID: ${PUID}
PGID: ${PGID}
volumes:
- ${CONFIG}/ombi:/config
restart: unless-stopped
Using docker-compose (or within portainer, stacks) lets you create a set of images that then can talk to another easily because it automatically creates a user-defined bridge network that has a DNS server incorporated into it and also deploys all of these images automatically. So now I can just type in 'nzbget' into the hostname and it works. The ${DATA}, ${CONFIG} etc are Environment variables (env), they allow me to change the location of the files when I want easily, DATA stores the data files, CONFIG is appdata, DOWNLOAD is where the downloads go, PUID/PGID are user id and group id, explained in the post above and are something that linuxserver images have to allow for images to not have admin issues with folders/files.
There is something called watchtower that I don't use that would update images automatically, I think this is bad practice without a backup because an updated image could break your configs due to not updating properly.
You could also add in torrenting into this pretty easily following the template and the original template is based off of https://github.com/duhio/docker-compose-usenet which uses sabnzbd (which is python based vs nzbget which is c++). This also has the ability to create a reverse proxy so you can do things like sonarr.hostname.com, but I don't have a domain setup yet and don't really need one.
Hope this helps someone.
- oyvindo
- Experience counts
- Posts: 1399
- Joined: Tue May 19, 2009 2:08 am
- Location: Norway, Oslo
Re: Using Default NAT can't resolve hostnames
There must bean easier way to achieve this than to install Portainer?
I have nothing against Portainer, but it is not convenient if to write a tutorial assuming the reader is willing or able to install Portainer just to accomplish something so fundamental.
So, does anyone know how to assign hostname to a container during installation in Container Station?
I have nothing against Portainer, but it is not convenient if to write a tutorial assuming the reader is willing or able to install Portainer just to accomplish something so fundamental.
So, does anyone know how to assign hostname to a container during installation in Container Station?