Publish a Spring Boot app as a Docker container by using the Azure Toolkit for Eclipse

The Spring Framework is an open-source solution that helps Java developers create enterprise-level applications. One of the more-popular projects that is built on top of that platform is Spring Boot, which provides a simplified approach for creating standalone Java applications.

Docker is an open-source solution that helps developers automate the deployment, scaling, and management of their applications that are running in containers.

This tutorial walks you through the steps to deploy a Spring Boot application as a Docker container to Microsoft Azure by using the Azure Toolkit for Eclipse.


To complete the steps in this article, you will need to install the Azure Toolkit for Eclipse, which requires the following software components:


The Azure Toolkit for Eclipse page at the Eclipse Marketplace lists the builds that are compatible with the toolkit.

Clone the default Spring Boot Docker repository

Import the public repository

The following steps walk you through cloning the Spring Boot Docker repository to your local computer by using IntelliJ. If you want to use a command line, see Deploy a Spring Boot application on Linux in Azure Container Service.

  1. Open Eclipse.

  2. Click File > Import.

    File Import menu

  3. When the Import dialog box opens:

    a. Expand Git.

    b. Select Projects from Git.

    c. Click Next.

    Import dialog box

  4. On the Select Repository Source page:

    a. Select Clone URI.

    b. Click Next.

    Select Repository Source page

  5. On the Source Git Repository page:

    a. For URI, enter This step should automatically populate the Host and Repository path fields with the correct values.

    b. The Spring Boot repository is public, so you should not have to enter your Git username and password.

    c. Click Next.

    Source Git Repository page

  6. On the Branch Selection page, click Next.

    Branch Selection page

  7. On the Local Destination page:

    a. Specify the local folder where you want your local repo.

    b. Click Next.

    Local Destination page

  8. On the Select a wizard to use for importing projects page:

    a. Select Import as a general project.

    b. Click Next.

    "Select a wizard to use for importing projects" page

  9. On the Import Projects page:

    a. Specify your project name.

    b. Click Finish.

    Import Projects page

  10. When the repository is cloned successfully, you see all the files listed in Eclipse.

    Local repository

Create a Maven project from your local repository

The Spring Boot Docker repository contains a completed Maven project, which you will use for this tutorial.

  1. Click File > Import.

    Import command on the File menu

  2. When the Import dialog box opens:

    a. Expand Maven.

    b. Select Existing Maven Projects.

    c. Click Next.

    Import dialog box

  3. On the Maven Projects page:

    a. For Root Directory, specify the complete folder in your local repository.

    b. Expand the Advanced section, and enter a custom name for Name template.

    c. Select the box for the pom.xml file in the project.

    d. Click Finish.

    Maven Projects page

  4. When the Maven project is opened successfully, you see a second project listed in Eclipse.

    Local Maven project

Build your Spring Boot app by using Maven

  1. In the Eclipse Project Explorer, select the Maven project.

  2. Click Run > Run As > Maven build.

    Commands to run as Maven build

  3. When your application is successfully built, the console window shows the status.

    Successful Maven build

Publish your web app to Azure by using a Docker container

  1. In the Eclipse Project Explorer, select the Maven project.

  2. Click the Azure Publish menu, and then click Publish as Docker Container.

    Publish as Docker Container command

  3. When the Deploying Docker Container on Azure dialog box appears:

    a. Enter a custom Docker image name.

    b. For Artifact to deploy, specify the path to the gs-spring-boot-docker-0.1.0.jar file you just built.

    Specify Docker options

    Any existing Docker hosts are displayed.

  4. If you choose to deploy to an existing host, you can skip to step 5. Otherwise, use the following steps to create a host:

    a. Click Add.

    Add a new Docker host

    b. When the Create Docker Host dialog box appears, you can choose to accept the defaults, or you can specify any custom settings for your new Docker host. (For detailed descriptions of the various settings, see Publish a web app as a Docker container by using the Azure Toolkit for IntelliJ.) Click Next when you have specified which settings to use.

    Specify Docker host options

    c. You can choose to use existing login credentials from an Azure key vault, or you can choose to enter new Docker login credentials. Click Finish when you have specified your options.

    Specify Docker host credentials

  5. Select your Docker host, and then click Next.

    Select Docker host to use

  6. On the last page of the Deploying Docker Container on Azure dialog box, specify the following options:

    a. You can choose to specify a custom name for the container that will host your Docker container, or you can accept the default.

    b. Enter the TCP ports for your docker host by using the following syntax: [external port]:[internal port]. For example, 80:8080 specifies an external port of 80 and the default internal Spring Boot port of 8080.

    If you have customized your internal port (for example, by editing the application.yml file), you need to specify the port number for the correct routing to occur in Azure.

    c. After you configure these options, click Finish.

    Deploy a Docker container on Azure

  7. When the Azure Toolkit has finished publishing, the Azure Activity Log displays Published for the status.

    Successfully deployed Docker host

Next steps

For additional resources for Docker, see the official Docker website.

To report bugs or request new features, create issues on our GitHub repository. Or, ask questions on Stack Overflow with tag azure-java-tools.

For more information about using Java with Azure, see the following links: