In on-premises container mode, the Alibaba Cloud Toolkit plug-in starts the container in an on-premises environment and runs your microservice application in the container. This topic describes how to configure the on-premises container mode.
Background information
The on-premises container mode provides the following advantages:
- Non-Java microservice applications are supported.
- On-premises microservice applications can run in an on-premises container that uses
the same operating system as the container in the production environment.
For example, if the on-premises environment uses a Windows operating system to develop applications but the production environment uses a Linux operating system to run applications, you can use the on-premises container mode to run a Linux container in the on-premises environment and run your microservice application in the Linux container.
The following figure shows the overall architecture in which the on-premises container mode is used.

Step 1: Configure the on-premises container mode
Step 2: Run the container
Run the container. If you run the container for the first time, the Alibaba Cloud Toolkit plug-in automatically pulls the default container image and related tools required by the underlying layer. This process is time-consuming. The following figure shows the startup log after the container is initialized.

(Optional) Step 3: Debug Java applications
The Alibaba Cloud Toolkit plug-in uses the JAVA_TOOL_OPTIONS parameter to enable Java application debugging and exposes the debugging port to the host. By default, port 5005 is used for debugging. If the port is occupied, the next consecutive port is used.

Port mappings
The Alibaba Cloud Toolkit plug-in maps the debugging ports and Spring Cloud service ports of Java applications to host ports.
- Debugging ports: By default, port 5005 is used to debug Java applications. If the port is occupied, the next consecutive port is used. The Alibaba Cloud Toolkit plug-in uses the JAVA_TOOL_OPTIONS parameter to specify debugging information. If you do not use an image to start the container, the default container image uses the debugging information to run your microservice application. If you use a custom image to start the container, you must specify the AVA_TOOL_OPTIONS parameter in your startup script to start your microservice application.
- Spring Cloud service ports: By default, port 8080 is used. If the port is occupied, the next consecutive port is used. The Spring Cloud service ports can be overwritten by the on-premises Spring Cloud service ports in the configurations for the interconnection between on-premises and cloud applications.
Microservice environment variables
When the Alibaba Cloud Toolkit plug-in starts, the plug-in ingests the following environment variables into the on-premises microservice container. If you do not use an image to start the container, the startup script of the default container image automatically identifies the following environment variables and starts the container. If you use a custom image to start the container, you can use these environment variables based on your business requirements.
| Environment variable name | Environment variable value |
|---|---|
| PRODUCT | Specifies the cloud product type of the current runtime environment. You can set this environment variable to EDAS, SAE, or MSE. |
| JAVA_TOOL_OPTIONS | -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=<Debugging port number>. By default, port 5005 is used for debugging. If the port is occupied, the next consecutive
port is used.
|
| ADDRESS_SERVER_HOST | Specifies the host address of the Address Server. |
| ADDRESS_SERVER_PORT | Specifies the port number of the Address Server. |
| ACCESS_KEY | Specifies the AccessKey ID used in the namespace. |
| SECRET_KEY | Specifies the AccessKey secret used in the namespace. |
| TENANT_ID | Specifies the ID of the namespace. |
| SUB_ONLY | This parameter is set to true if subscribeOnly is set to true in the configurations for the interconnection between on-premises and cloud applications. |
| PROJECT_NAME | Specifies the ID of the application to which on-premises microservices belong. |
| REMOTE_IP | Specifies the internal IP address of the remote proxy. By default, the IP address of eth0 is used. |
Maven project description
If you select Maven Build for Artifact, you must add a Maven project to the container configuration.

