All Products
Search
Document Center

Microservices Engine:On-premises container mode

Last Updated:Mar 10, 2026

On-premises container mode runs microservice applications inside a local Docker container that mirrors your production environment. The Alibaba Cloud Toolkit plug-in for IntelliJ IDEA manages the container lifecycle -- from image setup and port mapping to environment variable injection -- so you can develop and debug locally before deploying to the cloud.

When to use on-premises container mode

Use on-premises container mode when:

  • Your local OS differs from production. For example, if you develop on Windows but deploy to Linux, on-premises container mode runs a Linux container locally so your application behaves the same way it does in production.

  • Your application is not Java-based. The default local run mode supports only Java applications. On-premises container mode supports any language through a custom container image.

If your application is a Java microservice and your local OS matches production, running the application directly in IntelliJ IDEA without a container is simpler.

How it works

The Alibaba Cloud Toolkit plug-in performs the following steps:

  1. Builds or locates the application artifact -- either by running a Maven build or by using a local file you specify.

  2. Starts a Docker container on your local machine using either a default image (for Java, Tomcat, or HSF applications) or a custom image you provide.

  3. Injects microservice environment variables into the container, including service discovery endpoints, namespace credentials, and debugging configuration.

  4. Maps ports between the container and your host machine, exposing debugging ports and service ports automatically.

The following diagram illustrates the architecture.

Architecture of on-premises container mode

Prerequisites

Before you begin, ensure that you have:

  • IntelliJ IDEA installed

  • Docker installed and running on your local machine

  • The Alibaba Cloud Toolkit plug-in installed in IntelliJ IDEA

Step 1: Configure the on-premises container

  1. Open IntelliJ IDEA.

  2. In the menu bar, choose Run > Edit Configurations....

  3. In the Run/Debug Configurations dialog box, click the plus sign (+) in the upper-left corner.

  4. Expand Alibaba Microservice Container and click the name of your on-premises container.

  5. Configure the parameters described in Configuration parameters.

    Run/Debug Configurations dialog box

  6. Click OK.

Configuration parameters

ParameterDescription
NameA name for the on-premises container configuration.
ServerThe Docker daemon to use. Only the local Docker daemon is supported. This value is fixed to Local Docker Server.
Application typeThe type of application to run. This determines which container image the plug-in uses. See Application types for details.
ArtifactThe source of the application package. Applies only when Application type is not set to Image. See Artifact options for details.
Image ID or nameThe ID or name of a custom container image. Applies only when Application type is set to Image.
EntrypointA custom entrypoint that overrides the default entrypoint of the container image. Applies only when Application type is set to Image.
CommandA custom command that overrides the default command of the container image. Applies only when Application type is set to Image.
Bind portsPort mappings between the host and the container, in <Host port number>:<Container port number> format. Separate multiple port mappings with spaces. The plug-in automatically exposes Spring Cloud service ports and debugging ports, so this parameter is optional in most cases. See Port mappings for defaults.
Bind mountsDirectory mappings between the host and the container, in <Host file directory>:<Container file directory> format. Separate multiple directory mappings with spaces. Mapped directories are shared between the host and the container for read and write access.
Environment variablesEnvironment variables to pass to the container, in <Key>=<Value> format. Separate multiple variables with semicolons (;). The plug-in automatically injects microservice-related variables. See Microservice environment variables for the full list.

Application types

TypeUse case
JavaJava applications built on Spring Cloud or Dubbo. Package format: JAR.
TomcatJava applications built on Spring Cloud or Dubbo. Package format: WAR.
HSF-ContainerJava applications built on High-speed Service Framework (HSF). Package format: JAR or WAR.
ImageAny application. Uses a custom container image that you provide.

When you select Image, the plug-in runs your custom container image as-is. For all other types, the plug-in uses a default container image with a built-in startup script.

Artifact options

This parameter applies only when Application type is not set to Image.

OptionDescription
Maven BuildBuilds the project with Maven and runs the resulting package. You must add a Maven build step to the configuration. See Set up a Maven build.
Use FileUses a local file as the application package.

Step 2: Run the container

Run the configuration. On the first run, the plug-in pulls the default container image and downloads required tools. This initial setup takes several minutes.

After the container starts, the startup log appears in the IntelliJ IDEA console.

Container startup log

Step 3 (optional): Debug Java applications

The plug-in automatically enables Java debugging by setting the JAVA_TOOL_OPTIONS environment variable with JDWP configuration. The default debugging port is 5005. If port 5005 is occupied, the plug-in uses the next consecutive port.

Connect to the debugging port with a remote debugging tool, or use the debugger attaching feature in IntelliJ IDEA.

Debugger attaching in IntelliJ IDEA

Port mappings

The plug-in automatically maps the following ports from the container to the host.

Port typeDefault portFallback behavior
Debugging port5005If occupied, the plug-in uses the next consecutive port.
Spring Cloud service port8080If occupied, the plug-in uses the next consecutive port. This port can be overridden by the on-premises Spring Cloud service port configured for interconnection between on-premises and cloud applications.

For default container images (Java, Tomcat, HSF-Container): The built-in startup script reads the JAVA_TOOL_OPTIONS variable and configures debugging automatically.

For custom container images (Image type): Add the JAVA_TOOL_OPTIONS variable to your startup script to enable debugging. Set the variable value to:

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=<debugging-port>

Microservice environment variables

The plug-in injects the following environment variables into the container at startup, grouped by purpose.

Debugging

VariableValueDescription
JAVA_TOOL_OPTIONS-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=<debugging-port>Enables JDWP debugging. The default port is 5005.

Service discovery

VariableValueDescription
ADDRESS_SERVER_HOSTAuto-configuredHost address of the Address Server.
ADDRESS_SERVER_PORTAuto-configuredPort number of the Address Server.
PRODUCTEDAS, SAE, or MSEThe Alibaba Cloud product type for the current runtime.

Authentication

VariableValueDescription
ACCESS_KEYAuto-configuredThe AccessKey ID for the namespace.
SECRET_KEYAuto-configuredThe AccessKey secret for the namespace.
TENANT_IDAuto-configuredThe ID of the namespace.

Application configuration

VariableValueDescription
PROJECT_NAMEAuto-configuredThe ID of the application that the on-premises microservice belongs to.
SUB_ONLYtrue or not setSet to true when subscribeOnly is enabled in the interconnection configuration between on-premises and cloud applications.
REMOTE_IPAuto-configuredInternal IP address of the remote proxy. Defaults to the IP address of eth0.

For default container images: The startup script reads these variables automatically and configures the application.

For custom container images: Use these variables in your own startup script as needed.

Set up a Maven build

If you select Maven Build for Artifact, add a Maven build step to the container configuration.

  1. In the on-premises container configuration, scroll to the Before launch section.

  2. Click the plus sign (+) and select Run Maven Goal.

  3. In the Select Maven Goal dialog box, specify the module and the Maven command.

Select Maven Goal dialog box

Multi-module Maven projects

For projects with multiple modules, add two Maven build steps in the following order:

  1. Root project: Enter clean install in the Command line field. This builds all modules.

  2. Target module: Enter clean package in the Command line field. The plug-in uses the package produced by this module to run the container.