Catalina
Catalina

Reputation: 27

Port forwarding in Jelastic with Docker

I have simple application which has rest api on port 4567 and run it in my docker container in jelastic cloud. Now I want to forward port 4567 to the external world. When I run docker locally I can do it like that: docker run -d -p 4567:4567 -ti myapp /bin/bash
But how can I do that in jelastic without external IP? I've also tried to use jelastic endpoints but port is not available. Also found some information on jelastic's docs: "In case your Docker container does not have an external IP attached, Jelastic performs an automatic port redirect. This means that if application listens to a custom port on TCP level, Jelastic will try to automatically detect it and forward all the incoming requests to this port number. As a result, in most cases, your dockerized app or service will become available over the Internet under the corresponding node’s domain right after creation."
To build docker image I use Dockerfile and it has "EXPOSE 4567" field.

Upvotes: 0

Views: 1307

Answers (1)

Virtuozzo
Virtuozzo

Reputation: 1993

@Catalina,

Pay attention that there is no need to expose ports in Jelastic because it uses PCS container-based virtualization, which is more technologically advanced compared to the native Docker containers’ implementation: it has the built-in support of the natural virtual host-routed network adapters.

By default, Jelastic automatically detects the ports, that are predefined to be listened by an application within the appropriate Docker image settings, and applies the required redirects to ensure container’s accessibility right after the deployment.

Port forwarding in Jelastic with Docker

Let us explain which ports are listening on Shared Load Balancer (SLB) and can be forwarded to the containers:

80 -> HTTP

8080 -> HTTP

8686 -> HTTP

8443 -> SSL

4848 (glassfish admin) -> SSL

4949 (wildfly admin) -> HTTP

7979 (import/export feature) -> SSL

In the case when you want to specify another port instead of selected by auto-redirect functionality you can do it by specifying the JELASTIC_EXPOSE docker variable in the environment settings wizard to specify the needed port.

JELASTIC_EXPOSE variable should be used, with the following values as possible:

  • 0 or DISABLED or FALSE - to disable auto-redirect
  • a number within the 1-65535 range - to define the required port for setting the corresponding redirect

Also, you can either map the required private port via endpoint (for being accessible over Shared LB) and bind your service to the received address and shared port.

Upvotes: 2

Related Questions