Hello everybody! I have the following issue: I have two countainers, let’s call them C1 and C2, and they both expose the same port, let’s say 1234. I want to route both of them through a gluetun container. to do this, I added

network_mode: container:gluetun

at each container. But they both expose the same port, so there’s a conflict. Without routing them though gluetun I can just

ports:
  - 1235:1234

but using network_mode this cannot be done. What can I do? The only thing that comes to my mind is to use two gluetun containers, but I’d rather use a single one

thanks in advance!

@Fedegenerate@lemmynsfw.com
link
fedilink
English
5
edit-2
4d

On mobile so you’ll have to forgive format jank.

It depends how each image handles ports if C1 has the ports set up as 1234:100 and C2 has the ports set up as 1234:500 then:

service:

gluetun:

ports:

 - 1234:100 #c1
 - 1235:500 #c2

[…]

Will solve the conflict

Sometimes an image will allow you to edit it’s internal ports with an environment so

service:

gluetun:

ports:

  - 1234:1000 #c1
  -1235:1234 #c2

c1:

environent:

- UI_PORT=1000

[…]

When both contsiners use the same second number, C1: 1234:80, C21235:80, and neither documents suggest how to change that port, I personally haven’t found a way to resolve that conflict.

tubbadu
creator
link
fedilink
English
23d

thanks for the detailed reply!

When both contsiners use the same second number, C1: 1234:80, C21235:80, and neither documents suggest how to change that port, I personally haven’t found a way to resolve that conflict.

unfortunately I’m in this situation, so I guess my only ways are to modify the container by hand or to create two instances of gluetun. thank you very much for your help!

Create a post

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.

Rules:

  1. Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

  • 1 user online
  • 246 users / day
  • 642 users / week
  • 1.41K users / month
  • 3.93K users / 6 months
  • 1 subscriber
  • 3.78K Posts
  • 76.7K Comments
  • Modlog