dockerfirewalljelastic

Change port number of docker service exposed publicly in jelastic


I want to provide a custom sftp service on port 22 using the jelastic cloud platform. The sftp service is implemented as a docker container running on a jelastic docker host. The issue is that the container also runs a native ssh on port 22 (to access the container) and I want the custom service, not the native one to be accessible on port 22.

The custom sftp docker container exposes the service on port 2222 on the host, while the native ssh uses port 22. I would like port 2222 to be exposed to the public as port 22 by the environment. The native ssh need not be exposed outside the environment, as it can be accessed using the jelastic internal gateway.

The jelastic platform allows to configure firewall rules, but does not allow to map the port. I would need something that maps port 2222 on the docker node to port 22 of the environment. The environment has a public ip. Changing the port of the native ssh could work, but this may interfere with the jelastic internal management.


Solution

  • The environment has a public ip.

    If you have a public IP on the node in question, your traffic hits that node directly from the internet. That means whatever ports you expose on the node / firewall are the ones accessible from the internet.

    In other words, you cannot run 2 different things on the same port. You would need to move SSH to a different port (and access it directly rather than using the Jelastic SSH gateway, as that wouldn't be able to know which port to connect on).