Sorry that was my question, dont want to use the port twice, I want to tell the compose file what to use for each container, but I dont know how.
Comment on 2 docker containers on same port?
thepianistfroggollum@lemmynsfw.com 11 months ago
Just use a different port number. I’m not sure why it’s necessary to use the same one since you can change qbittorrent’s port in the config files.
Fjor@lemm.ee 11 months ago
thepianistfroggollum@lemmynsfw.com 11 months ago
Ah, well the qbittorrent config file should live in the directory you mapped to /config. I think you can pull the default one and edit it for your container.
breadsmasher@lemmy.world 11 months ago
In 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
… ports: - ‘8080:8080’ - ‘9090:9090’ …
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
qtorrent: ports: - 8080:8080 sabnzb: ports: - 9090:8080
breadsmasher@lemmy.world 11 months ago
You can also map different ports to the container. For sake of argument lets say qtorrent had a fixed port you cannot change, that’s just what the application listens to. You can then map a different container port to that application port.
tldr, OP, you can’t have two containers in docker on the same container port
Fjor@lemm.ee 11 months ago
Right, my bad for the misleading/wrong title. This is my question - how do i map a port to a container that uses network_mode: …
thepianistfroggollum@lemmynsfw.com 11 months ago
Fair enough, but OPs problem can be solved by changing a 0 to a 1 in a single file.
Fjor@lemm.ee 11 months ago
how haha