0

I have multiple docker containers that (by default) can be accessed via port 80. I'm able to run them all on the same machine by mapping their default ports in the docker-compose files, like so:

services:
  application1:
    container_name: app1
    ports:
      - 8000:80
services:
  application2:
    container_name: app2
    ports:
      - 8001:80

Application 1 and 2 are unrelated. They both just happen to use port 80 by default. Using this configuration, I can access application 1 at <url>:8000 and application 2 at <url>:8001. This works without issue.

I'd like to switch to using another container to manage the network so I can implement a firewall. However, when I use the network_mode: container:firewall, I'm no longer able to specify the port mappings on the individual containers. I can specify mappings on the firewall container, but, if there are two application containers that are both trying to use port 80, I don't now how to differentiate them. Is there some way to use network_mode, but still map ports on the individual container level?

et_al
  • 1

0 Answers0