The Links section is intended for establishing connection between your Docker containers (obviously, they should be placed at different layers inside a single environment for that).
After such a connection is set, a container will be able to work with environment variables of the linked template (herewith, the imported properties will have a special prefix to be easily separated from this container’s native ones).
- To set a new link, click the Add button and fill in the appeared fields:
Node - select the layer with the required image using the drop-down list of ones, available within the current environment
Alias - type a connection alias (DB in our case). Subsequently, it will be used as a prefix for the chosen container’s variables, imported to the currently configured one.

- After that click Save to confirm linking settings. You can link as many different nodes to a single container as you require.
- You always can Edit or Remove the unnecessary link with the corresponding buttons at the top pane of the Docker layer settings frame.
docker layer
After the new settings are applied, you can check the results by switching to the Variables section (where the newly imported parameters will be listed).
Tip: Upon linking Docker containers, Jelastic also adds the corresponding DNS record (with the identical to the used alias name)
to Jelastic DB. In such a way, you can refer to a particular container
from inside of these two environment layers not just over its IP
address or NodeID, but also specifying the assigned alias with
counter, i.e. {alias_name}_N.
For example, after linking with DB alias (as it’s shown above), you
can ping specific containers at the appropriate layer as “db_1”,
“db_2”, etc while working with Platform internal network via Jelastic
SSH Gateway. Herewith, if using common layer alias (i.e. without
counter, “db” in our case), the system will use Round-Robin algorithm
to choose any container within the defined node group.
https://docs.jelastic.com/docker-links
UPD1
In order to initialize database add these variables to MariaDB:
MYSQL_ROOT_PASSWORD
This variable is mandatory and specifies the password that will be set for the MariaDB root superuser account. In the above example, it was set to my-secret-pw.
MYSQL_DATABASE
This variable is optional and allows you to specify the name of a database to be created on image startup. If a user/password was supplied (see below) then that user will be granted superuser access (corresponding to GRANT ALL) to this database.
MYSQL_USER, MYSQL_PASSWORD
These variables are optional, used in conjunction to create a new user and to set that user's password. This user will be granted superuser permissions (see above) for the database specified by the MYSQL_DATABASE variable. Both variables are required for a user to be created.