IMPORTANT:
Please quickly search the existing issues and make sure that you're not create a duplicate issue. If you have a quesetion about a particular Dockerfile and deployment, change your questions to Dockerfile and post it where appropriate such as StackOverflow. This is a Docker question, not a CapRover specific issue.
Please clearly state your question:
I have a container called container-001 that has mapping 8081:8080, so I can access the web server in it via http://mydomain.com:8081. Due to some issues it's not an option to deploy the container with CapRover, so it's launched with Docker Compose.
This doesn't feel clean and I want to avoid exposing port 8081 externally, only use CapRover to reverse proxy this container and enable HTTPS for https://my-server.mydomain.com.
I tried to set up a nginx One-Click application with CapRover but don't understand how I can connect it to container-001 which is not managed by CapRover.
How can I set up a reverse proxy for other containers not managed by CapRover inside CapRover?
It should be possible.
1) Make sure your container is attached to CapRover overlay network captain-overlay-network
2) Create the nginx reverser proxy app
3) for upstream domain use http://container-001:8080
@githubsaturn Sorry to bother again, but how should I attach my container to captain-overlay-network with Docker compose?
I found this example, but not sure where I should specify captain-overlay-network. Haven't found much documentation on this.
I tried to add it to networks but Docker tells me ERROR: Service "container-001" uses an undefined network "captain-overlay-network".
version: "3.3"
services:
container-001:
image: publisher/docker-image
container_name: container-001
networks:
- captain-overlay-network
Try this: https://docs.docker.com/compose/networking/#use-a-pre-existing-network
Thank you, it worked!!
Most helpful comment
Try this: https://docs.docker.com/compose/networking/#use-a-pre-existing-network