Knowledge Base
MilesWeb / Cloud Servers

DNS Hostnames for Direct Connection to Containers at MilesWeb PaaS

Approx. read time : 4 min

Getting easily connected to your cloud is the most important criterion for all the developers. In MilesWeb, each new node that is created is assigned particular number of hostnames which are automatically generated, pointing to the appropriate server’s internal/external IP address.

The set of hostnames can differ based on a type of the created node. This article will help you to learn all the ways for referring to a particular node, hosted at MilesWeb PaaS powered by Jelastic, from inside (i.e. when managing it via MilesWeb SSH Gate) as well as outside of the cloud. Additionally, we will offer you some useful hints for interconnecting your nodes via Platform internal network.

Let’s get started with the most common hostnames assigned to any container. One done with that, we will summarize some specific hostname aliases for Docker containers and dockerized MilesWeb-managed stacks.

Hostnames for Specific Container

You can use the below formats of node hostnames for getting internal IP of a specific container for getting the access further:

  • node${nodeId}–${envName}.${platformDomain}
  • node${nodeId}.${envName}.${platformDomain}

The placeholders in bold-italic need to be replaced with the below values:

  • ${nodeId} – It is a unique digit identifier generated automatically and is assigned to each container within a Platform

  • ${envName} – It is the environment name (not an alias) that is mentioned during its creation.
  • ${platformDomain} – It is the domain name of a hosting service provider MilesWeb installation.

You can use both variants in order to refer to the nodes from inside or outside of the platform (i.e. it will allow to establish internal as well as external connections).

Short Hostnames for All Containers in One Environment

A specific DNS rule is provided to all the newly created Docker containers (since 4.8 version) and dockerized Jelastic-managed stacks (since 5.1 release), allowing usage of the additional simplified hostname type:

  • node${nodeId} – It is the alias for referring to a container in the limits of a single environment.

When such short domains in the application source code, server configuration files and SSH console (within often used commands like hot, ping, dig, etc) the operating with Dockerized stacks via Platform internal network becomes more convenient. Also, due to this type of approach the environment migration to another hardware region becomes painless by eliminating the need of adjusting your application code due to the changed server location.

Short Hostnames for Containers in One Layer

For getting all internal IP addresses of containers within a single node layer of a specific environment, you need to use the below hostname:

  • ${nodeGroup}.${envName}.${platformDomain}

where ${nodeGroup} placeholder is a name of the layer (cp, sqldb, bl, nosqldb, cache, storage, vps, build, etc.) the required container belongs to.

In this case with our environment, the following command needs to be used to get the DNS record:


Each time a new container is created in a system – there’s addition of a new round-robin record automatically to DNS to the specific layer name.

When two environment layers are linked, a set of dedicated DNS records automatically get added to the global Jelastic database. This enables referring to the nodes within a target layer from the source ones (but not vice versa) when working in the limits of these two layers using the below hostname aliases:

  • ${linkAlias} – for connecting to a random node within target layer; an exact node for responding is chosen with the Round-Robin algorithm for ensuring even load distribution.
  • ${linkAlias}_${N} – for accessing a particular container within a target layer.

Here, the suitable placeholders are to be replaced with:

  • ${linkAlias} – link name specified during its setting (e.g. tomcat in the image below)

  • ${N} – nominal index number (in a 1…N range) of a specific container within the target linking layer (e.g. tomcat_1, tomcat_2), etc; with this, master container is always considered the 1st instance, while the remaining nodes within a layer are numbered as per their nodeID values, distributed in the ascending order (starting with the _2 index respectively).

For example, consider there are three containers on a layer – with the 23, 124 (master) and 125 IDs. As per the above-described implementation, the aliases will be allocated as below:

  • alias_1 – link as a master node to the 124 container
  • alias_2 – will point to the 123 instance as it has the lowest ID as compared to the remaining containers
  • alias_3 – in order to refer to the 125 container as the one with the next lowest nodeID

Note: By adding the environment domain to the alias ${linkAlias}.${envName}.${platformDomain}, the equivalent linked layer name can be resolved and accessed externally, i.e. from anywhere over the Internet. Also, with ${linkAlias}_${N}, a linked layer’s equivalent container can be resolved internally only, within the linked layers network.

Finally, you are aware of all the specifics and shortcuts that can be used your node reference, helping you in quick and efficient organization of connections between your application instances. Don’t miss to try this and several other features of MilesWeb cloud platform powered by Jelastic for yourself with a 30-days trial on our cloud.

Pallavi Godse
Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.
Need help? We’re always here for you.