docker-compose with multiple networks

cn flag

I want to install NextCloud ( via docker-compose.

After analyzing the docker-compose structure, I see that this image is composed of two services (app and db).

Currently, in a server, I have all docker based services running in a macvlan network so that they are visible to the rest of the devices in the network

How can I tweak the NextCloud docker-compose file in order to have the app and db containers communicate with themselves via the regular docker network, but have NextCloud service be exposed to the macvlan network?

Something like below:

--real network----
| |
---------|--docker network--------------
|  ---------                 --------  |
|  |  app  |--|  db  |  | 
|  ---------                 --------  |

So in theory I should be able to access NextCloud with the real network.

I've read that a reverse proxy could be the way to go but how can I set it up this way?

jp flag
You need to expose appropriate ports, for them to be accessible from the real network.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.