Selfhosted
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:
-
Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.
-
No spam posting.
-
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.
-
Don't duplicate the full text of your blog or github here. Just post the link for folks to click.
-
Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
-
No trolling.
Resources:
- selfh.st Newsletter and index of selfhosted software and apps
- awesome-selfhosted software
- awesome-sysadmin resources
- Self-Hosted Podcast from Jupiter Broadcasting
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
view the rest of the comments
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.
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
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: ...
Fair enough, but OPs problem can be solved by changing a 0 to a 1 in a single file.
how haha
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.
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.
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
where you have
servicea listening on 8080 and serviceB on 8080 but exposed on 5000 and 6000 in the VPN service
for example
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.
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
edit - so you should end up with the vpn container exposing 8080 which points to the service exposing 8080 which maps to application listening on 8080
and the same for 9090 -> 9090 -> 8080
but I thought the containers had to have "network_mode: container:vpn", in order to strictly only be able to communicate through the VPN.
When I am home Ill get an example from my setup 👍
mercii :)
when I do this I get the error message that the ports are already in use by the vpn container :|