Comment on 2 docker containers on same port?
breadsmasher@lemmy.world 11 months agoIn the VPN service you just expose the port you want and map it to the listener port on the service
vpn: ports: - 5000:8080 - 6000:8080
for example
Comment on 2 docker containers on same port?
breadsmasher@lemmy.world 11 months agoIn the VPN service you just expose the port you want and map it to the listener port on the service
vpn: ports: - 5000:8080 - 6000:8080
for example
Fjor@lemm.ee 11 months ago
sorry im still quite new to this… do u have an example of another compose file that does this? Not sure where I put what.
breadsmasher@lemmy.world 11 months ago
On my phone so I haven’t got the access to give you a good example.
You see in your compose file in your original post you have ‘8080:8080’ under ports?
You should be able to add another line, the left hand side of the colon exposing a different port like so
then one service you can access on port 8080 and the other you access on 9090
then under each service you want to expose you add the other port mappings
Fjor@lemm.ee 11 months ago
when I do this I get the error message that the ports are already in use by the vpn container :|
Fjor@lemm.ee 11 months ago
but I thought the containers had to have “network_mode: container:vpn”, in order to strictly only be able to communicate through the VPN.
breadsmasher@lemmy.world 11 months ago
When I am home Ill get an example from my setup 👍