In part 1 of this series, we showed you how to get the most out of container orchestration in the Jelastic platform and in this post, we will focus on managing and optimizing your container configurations.
For more convenience, the Jelastic environment wizard provides you with a special graphic tool for adjusting basic configurations at your Docker® container, such as environment variables’ and ports’ settings, linking containers or specifying the file that should be run on its startup. Simultaneously powerful and user friendly, it gives you the ability to configure your Docker® template in the most easy and convenient way.
So, to start with, you need to access the Docker® container settings dialog frame. There are two ways that this can be done:
- if you don’t have a Docker®-based environment yet – click on the New environment button, add the needed container(s), select one that needs preconfiguration, and select the Edit button for it (see the image below)
- if you already have an environment with Docker® nodes – click on the Change environment topology button for it, select the container for further configuration and click on the Edit button
After that, the Docker® container settings window will appear:
As you can see, it contains 4 separate sections with the following settings’ options:
- Environment Variables
- Run Command
The first tab is Links, where you can establish the connections between your Docker® containers (obviously, you need to have at least two of them 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 own ones). As an example, we’ll connect the containers with Jelastic’s example WordPress templates.
- To set a new link, click the Add button and fill in the appeared fields:
- Node – select the required Docker® template 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 the settings of your link. 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® container settings frame.
After the new settings are applied, you can check the results by proceeding to the Environment Variables section.
At the Environment Variables tab, you’ll see the list of default for the current container variables, and, in case you’ve linked any container(s) to it – some imported ones (their names start with the previously specified alias, e.g. DB in our case).
Also, you can add your own custom variables – parameters that you’ll be able to define by yourself and use in a container.
- To state a custom variable, select the Add button and fill in the appeared cells with the required variable’s name and value. Then click Save.
- Besides adding, you can also Edit and Remove the already existing records with the help of the same-named buttons.
3. Click on Apply to save all the changes made in the Docker® container settings’ frame and one more time at the wizard window to apply them.
The third tab (Ports) provides you with the general information on managing Docker® container’s ports at Jelastic. You can bind the necessary port directly to the IP address (regardless whether it is internal or external) your container was provisioned with. Pay attention that there is no need to expose ports in Jelastic because it uses Virtuozzo container-based virtualization, which is more technologically advanced, compared with the native Docker® containers’ implementation: it has the built-in support of the natural virtual host-routed network adapters.
Thus, if you’d like your port to be accessible from the outside – just enable the Public IP option for your Docker® container and bind your service (app listener) to this address.
The last Run Command tab contains an input field, where you can set the name for your custom start script, command or binary file (in the latter case it should be specified within $PATH), which will be executed on the next and each subsequent container’s startups.
By default (i.e. if no custom argument is stated), the system inspects whether the required command hasn’t been declared in the template settings (CMD tag) and, if found nothing, checks the existence of the most commonly used start files, like start.sh or run.sh scripts, to run them automatically. Otherwise, i.e. if neither condition has been satisfied, nothing will be executed on the container’s startup, until you specify the required start point manually.
In order to perform any extra configurations, you need to establish the SSH connection to your Docker® node using SSH keypair or an external IP address. We believe that if you’ve got here by thoroughly reading this guide, you are fully prepared to start working with Docker® containers using the Jelastic Cloud Platform.
The consolidation of Jelastic and Docker® technologies helps to reach a wider market of public and private cloud customers who require more automation, security, optimization of resource consumption and flexibility, while setting and managing their applications, clusters and microservices.
In other words, if you value the order inside your project throughout whole its lifecycle, you’ll choose automation and security for your containers.
Don’t just take our word for it. Sign up for a two-week free trial and please share your experience in the comments below.