Over a million developers have joined DZone.

DNS Hostnames for Direct Connection to Containers at Jelastic

DZone 's Guide to

DNS Hostnames for Direct Connection to Containers at Jelastic

Connecting to your cloud services is essential, so here's how to configure container DNS hostnames within the Jelastic Cloud Platform.

· Cloud Zone ·
Free Resource

Being able to easily connect to your cloud services is a criterion of great importance for all developers. In Jelastic, each newly created node is assigned a number of automatically generated hostnames, pointed to the appropriate server internal/external IP address.

Depending on the type of the created node, the set of hostnames for it could differ. With this article, you'll learn all the possible ways to refer to a particular node, hosted at Jelastic Cloud, from both inside (i.e. when managing it via Jelastic SSH Gate) and outside of the cloud. Also, as an addition, we'll consider specific hostname aliases for Docker containers and Dockerized Jelastic-managed stacks to operate with them via the internal platform network.

Common Hostnames

Each container in the platform can be accessed by its internal IP address with the following hostname formats:

  • node${nodeId}${envName}.${platformUrl}
  • node${nodeId}.${envName}.${platformUrl}

Herewith, the highlighted placeholders should be replaced with the next values:

  • ${nodeId}: an automatically generated unique digit identifier, assigned to each container within a Platform
  • ${envName}: environment name (not an alias), specified during its creation
  • ${platformUrl}: domain name of the hosting service provider's Jelastic installation you use

Both of these domain formats can be used for referring to the nodes from either inside or outside of a platform (i.e. allowing you to establish both internal and external connections).


  • The latter reference string — with a period (".") as the separator — is supported for Docker containers starting from Jelastic version 4.8 and for the rest of the certified templates since the 5.1 release.
  • The custom domain (if any is attached) resolves the environment entry point and cannot be used to establish a connection to a particular container.

Supplementary Hostnames for Particular Node Types

Some Jelastic certified stacks are provisioned with additional hostname prefixes (i.e. where the appropriate stack name is used instead of the node string) to make their management more convenient.

Node Type Stack Additional Hostname
Custom Docker Сontainers docker${nodeId}-${envName}.${platformUrl}
Database Cassandra 1/2 cassandra${nodeId}-${envName}.${platformUrl}
CouchDB couchdb${nodeId}-${envName}.${platformUrl}
MariaDB 5/10 mariadb${nodeId}-${envName}.${platformUrl}
Memcached memcached${nodeId}-${envName}.${platformUrl}
MongoDB 2/3 mongodb${nodeId}-${envName}.${platformUrl}
MSSQL mssql${nodeId}-${envName}.${platformUrl}
MySQL 5.6/5.7 mysql${nodeId}-${envName}.${platformUrl}
Neo4j 1/2 neo4j${nodeId}-${envName}.${platformUrl}
OrientDB orientdb${nodeId}-${envName}.${platformUrl}
PostgreSQL 8/9 postgres${nodeId}-${envName}.${platformUrl}
Redis redis${nodeId}-${envName}.${platformUrl}


All alternative domain strings, shown in the table above, can be utilized just as common hostnames (described in the section above).

Short Hostnames

All the newly created Docker containers (since 4.8) and Dockerized Jelastic-managed stacks (since 5.1) are provisioned with a specific DNS rule, which allows usage of the additional simplified hostname type:

  • node${nodeId}: alias to refer to a container in the confines of a single environment

Utilizing such short domains in server configuration files, application source code, and SSH consoles (within often used commands like ping, host, dig, etc) makes operating with Dockerized stacks via the platform's internal network much more convenient. Additionally, such an approach enables painless environment migration to another hardware region by eliminating the need to adjust your application code due to the changed server location.

Hostnames for Linked Containers

Upon linking two Docker-based environment layers, a set of dedicated DNS records are automatically added to the global Jelastic database. This allows you to refer to the nodes within a target layer from the source ones (but not vice versa) when working in the confines of these two layers using the following hostname aliases:

  • ${linkAlias}: to connect to a random node within the target layer; an exact node to respond is chosen by means of the Round-Robin algorithm to ensure even load distribution.
  • ${linkAlias}_${N}: to access a particular container within a target layer.

Here, the appropriate placeholders are to be substituted with:

  • ${linkAlias}: link name you've specified during its setting (e.g. tomcat in the image below)
  • ${N}: nominal index number (in a 1...N range) of a particular container within the target linking layer (e.g. tomcat_1, tomcat_2), etc; herewith, the master container is always considered the first instance, whilst the rest of the nodes within a layer are assigned numbers according to their nodeID values, sorted in the ascending order (starting with the _2 index respectively)

For example, let's suppose there are three containers on a layer, with the 123, 124 (master), and 125 IDs. According to the above-described implementation, the aliases will be assigned as follows:

  • alias_1: link to the 124 container as a master node.
  • alias_2: will point to the 123 instance since it has the lowest ID among the remaining containers.
  • alias_3: reference to the 125 container as the one with the next lowest nodeID.

Tip: By appending an environment domain (i.e. .${envName}.${platformUrl}) to any of these aliases, the corresponding containers can be accessed externally, i.e. from anywhere over the Internet.

Now, as you know all the specifics of referring to the nodes within your Jelastic environment, you are able to quickly and conveniently organize connections between your application instances. Combine this ability with lots of the provided Jelastic Platform features and get the most from your application hosting in the cloud.

In case you face any issues, have questions or suggestions on the way the hostnames are resolved at Jelastic, leave a comment below or ask our technical experts at StackOverflow.

container dns connection ,docker container dns ,jelastic cloud ,cloud ,tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}