Docker Hostnames


13 posts in this topic Last Reply

Recommended Posts

  • 4 weeks later...
3 minutes ago, ethanpil said:

Can you point me in the right direction? Where can I read up on this?

There isn't much to read up on.

Toggle to advance mode in the top right corner of the container template and the extra parameter field is visible. Then you can add whatever docker parameter you need.

Link to post
  • 5 months later...
  • 1 month later...
  • 3 weeks later...

Hi,

 

I was wondering if anybody could help me?  

 

I have a container - linuxserver/unifi-controller  and I have a manual IP assigned, I have hit advanced > extra parameters, have added

--hostname unifi-ctrlr 

 

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name='unifi-controller' --net='br0' --ip='192.168.100.2' -e TZ="Australia/Sydney" -e HOST_OS="Unraid" -e 'UDP_PORT_3478'='3478' -e 'TCP_PORT_8080'='8080' -e 'TCP_PORT_8443'='8443' -e 'TCP_PORT_8880'='8880' -e 'TCP_PORT_8843'='8843' -e 'UDP_PORT_10001'='10001' -e 'PUID'='99' -e 'PGID'='100' -v '/mnt/user/appdata/unifi-controller':'/config':'rw' --hostname unifi-ctrlr 'linuxserver/unifi-controller'

2dcfd7d24e972ce44a0c44cf945e4685784659d778b54a613ce75886b444a9ac

The command finished successfully!

 

Anyway, the hostname doesn't appear to be assigned to the docker.  

 

Same thing for plex.  

 

Anyone have any ideas?

 

Cheers

 

Nik

Link to post

Docker doesn't/won't do this natively because it doesn't run a DHCP client. Registering hostnames in DNS is a function of the DHCP protocol and since the docker containers don't run a DHCP client, it'll never register those things in DNS.

 

The hostname parameter only allows you to specify the hostname of the container itself otherwise it uses the containers randomly assigned ID number as the hostname (it's useful if you have an application that requires a static hostname).

Link to post

I could be wrong here but I don't think that any setting, whether it is on the docker configuration or contained within Unraid somewhere, would have the effect that you want.  Whatever you set on the docker would apply to it's network only, and whatever was set on Unraid would apply to it's network only.    If that makes sense..

 

When you're on your computer you're resolving DNS through your router's dhcp/dns which isn't going to know anything about Unraid or docker containers. 

 

So from my point of view you only have 2 options... 

 

1) Every computer you use would have to have [i][u]it's[/i][/u] hosts file changed to include the hostnames you want, or

2) Have a router capable of setting custom hostnames... not sure if this is even a thing..

 

And I mean... then.... you know.... you could always bookmark the sites in your browser......... and not have to think about it.

Link to post
  • 4 weeks later...
On 1/16/2021 at 11:46 AM, np226 said:

Hi,

 

I was wondering if anybody could help me?  

 

I have a container - linuxserver/unifi-controller  and I have a manual IP assigned, I have hit advanced > extra parameters, have added

--hostname unifi-ctrlr 

 




root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name='unifi-controller' --net='br0' --ip='192.168.100.2' -e TZ="Australia/Sydney" -e HOST_OS="Unraid" -e 'UDP_PORT_3478'='3478' -e 'TCP_PORT_8080'='8080' -e 'TCP_PORT_8443'='8443' -e 'TCP_PORT_8880'='8880' -e 'TCP_PORT_8843'='8843' -e 'UDP_PORT_10001'='10001' -e 'PUID'='99' -e 'PGID'='100' -v '/mnt/user/appdata/unifi-controller':'/config':'rw' --hostname unifi-ctrlr 'linuxserver/unifi-controller'

2dcfd7d24e972ce44a0c44cf945e4685784659d778b54a613ce75886b444a9ac

The command finished successfully!

 

Anyway, the hostname doesn't appear to be assigned to the docker.  

 

Same thing for plex.  

 

Anyone have any ideas?

 

Cheers

 

Nik

 

I've been using this feature in docker-compose files (without unraid) but here I cannot get it to work.

One walk-thru has been to edit /etc/hosts and identify each container with it's ip like.

 

root@Tower:~# cat /etc/hosts
# Generated
127.0.0.1       Tower localhost
54.149.176.35   keys.lime-technology.com
172.20.0.11 mqtt
172.20.0.15 mariadb

 

Is not perfect but works

Link to post
14 minutes ago, MiQUEL said:

 

I've been using this feature in docker-compose files (without unraid) but here I cannot get it to work.

One walk-thru has been to edit /etc/hosts and identify each container with it's ip like.

 

root@Tower:~# cat /etc/hosts
# Generated
127.0.0.1       Tower localhost
54.149.176.35   keys.lime-technology.com
172.20.0.11 mqtt
172.20.0.15 mariadb

 

Is not perfect but works

Be aware with this method (and network config) that those docker IPs are subject to change.

Link to post
  • 1 month later...

not if they are defined in the appropiate input text when you configure it, right?

Although i don't really like how dockers behave if you create it directly with the assistant. I dont see a way to control them as I used to do with docker-compose, I dont know any option like "depends_on". And I think this is a must in complex environment where you need to be sure that X Y and Z have to be running before start A and B containers.



 

Link to post
3 hours ago, MiQUEL said:

I dont know any option like "depends_on". And I think this is a must in complex environment where you need to be sure that X Y and Z have to be running before start A and B containers.


You  CAN control the order in which docker containers are started under unRaid by re-ordering them on the Docker tab and also set delays in the sequence to allow for initialisation of specific containers before continuing with loading further containers.    I would have thought for most use cases this was sufficient?

Link to post

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.