Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Docker Networking - Container Name and different Port

Featured Replies

Hi,

I'm trying to use Docker Container name to map to different Container settings. My problem is that I need to give the setting a different port.
Same like with IP: 192.168.178.100:1234
Just with name: container-name:1234 (that is unfortunately not working)

  • Author

Can someone help me please?

  • Community Expert
On 8/6/2022 at 6:18 AM, Stephan M. said:

Hi,

I'm trying to use Docker Container name to map to different Container settings. My problem is that I need to give the setting a different port.
Same like with IP: 192.168.178.100:1234
Just with name: container-name:1234 (that is unfortunately not working)

I am not certain i understand the question. It sounds like you are trying to allow one container to talk to another using the container name as a hostname. If so you will need to have both containers on the same custom bridge network, the default bridge network will not work as it does not support using container names as internal hostnames. If they are on the same custom bridge network then the specifying container-name:port in the setting of one containers application should allow you to reach another (no need to make a port mapping in this case either so long as the port is only for internal communication). 

  • Author
13 hours ago, primeval_god said:

It sounds like you are trying to allow one container to talk to another using the container name as a hostname.

Yes

13 hours ago, primeval_god said:

so you will need to have both containers on the same custom bridge network

It is in the same docker custom network that is in bridge mode

13 hours ago, primeval_god said:

then the specifying container-name:port in the setting of one containers application should allow you to reach another

With just that the application is doing something like container_name:my_port:default_port_of_application

13 hours ago, primeval_god said:

no need to make a port mapping in this case either so long as the port is only for internal communication

how can I do that?

 

Thank you very much.

  • Community Expert
6 hours ago, Stephan M. said:

With just that the application is doing something like container_name:my_port:default_port_of_application

I think i may see the issue. Rather than specifying container-name:my_port just specify container-name to the application, it looks like it will add the default port number on its own.

When working with containers that communicate on an internal network there is not need to use port mapping (-p option on cli or the port field in dockerman templates). When communicating via the same custom docker network containers have access to all of each others ports. Port mappings are just for making ports accessible externally on the docker host.

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.