<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Docker Spring Boot - Medium]]></title>
        <description><![CDATA[Dockerize Spring Boot App - Medium]]></description>
        <link>https://medium.com/sudharao?source=rss----ef72853bf21c---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Docker Spring Boot - Medium</title>
            <link>https://medium.com/sudharao?source=rss----ef72853bf21c---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 09:53:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/sudharao" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Dockerize Spring Boot Application]]></title>
            <link>https://medium.com/sudharao/dockerize-spring-boot-application-97a640605b28?source=rss----ef72853bf21c---4</link>
            <guid isPermaLink="false">https://medium.com/p/97a640605b28</guid>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[GoodDeeds]]></dc:creator>
            <pubDate>Fri, 15 Dec 2017 16:51:14 GMT</pubDate>
            <atom:updated>2017-12-15T16:51:13.552Z</atom:updated>
            <content:encoded><![CDATA[<p>In this example I will be creating simple hello world Spring Boot Application and containerizing using Docker.First, let us see what are all the technologies and tool used for this example.</p><p>Technologies and Tools Used:</p><ol><li>Java 1.8, JRE 1.8 ( To download goto <a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html">http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html</a> )</li></ol><p>2. Maven 4.0.0</p><p>3. Spring Boot Version 1.5.8</p><p>4. Spring Tool Suite(Version: 3.9.1.RELEASE(to download: <a href="https://spring.io/tools/sts/all">https://spring.io/tools/sts/all</a> )</p><p>5. Docker Community Edition Version: Version 17.09.0-ce-mac35 (19611) (To Install Docker: <a href="https://docs.docker.com/docker-for-mac/install/">https://docs.docker.com/docker-for-mac/install/</a> )</p><p>The tool or IDE used to create a project is STS. Follwo the steps below to create a simple hello-spring-boot-dockers project.</p><blockquote>Note: Assumption here is that one has basic knowledge on how to use Eclipse/ STS IDE and know how to create a simple Project.</blockquote><p>Step1: Right click and go to New-&gt; Spring Starter Project</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*uWS3VczzOUpbRHUP." /></figure><p>Step 2: Next enter the values in the following fields: Name, Type, Java Version, Group id, Artifact Id, Version, Package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*_ox2Sld6q6OsBy64." /></figure><p>Step 3: Choose Spring Boot Version. Here I am using 1.5.8. Since we are using rest we will choose Web for project dependencies, so I selected web from the list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*q4aaltxKCF4GBVcY." /></figure><p>Step 4: Click Finish. This will create Spring Boot Maven project with all the Maven, Web and Spring dependencies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*Bo9-ztt6dAlOE8TQ." /></figure><p>Once complete, you workspace will have the hello-spring-boot-docker project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*e2dHweTZlwFoBudv." /></figure><p>The Maven pom.xml that is generated looks like this:</p><blockquote>&lt;?xml version=”1.0&quot; encoding=”UTF-8&quot;?&gt;<br>&lt;project xmlns=”<a href="http://maven.apache.org/POM/4.0.0">http://maven.apache.org/POM/4.0.0</a>&quot; xmlns:xsi=”<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>&quot;</blockquote><blockquote>xsi:schemaLocation=”<a href="http://maven.apache.org/POM/4.0.0">http://maven.apache.org/POM/4.0.0</a> <a href="http://maven.apache.org/xsd/maven-4.0.0.xsd">http://maven.apache.org/xsd/maven-4.0.0.xsd</a>&quot;&gt;</blockquote><blockquote>&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;</blockquote><blockquote>&lt;groupId&gt;com.hello&lt;/groupId&gt;<br> &lt;artifactId&gt;hello-spring-boot-docker&lt;/artifactId&gt;<br> &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;<br> &lt;packaging&gt;jar&lt;/packaging&gt;<br> &lt;name&gt;hello-spring-boot-docker&lt;/name&gt;<br> &lt;description&gt;Hello Spring Boot Docker Sample&lt;/description&gt;</blockquote><blockquote>&lt;parent&gt;<br> &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br> &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;<br> &lt;version&gt;1.5.8.RELEASE&lt;/version&gt;<br> &lt;relativePath/&gt; &lt;! — lookup parent from repository →<br> &lt;/parent&gt;<br> &lt;properties&gt;<br> &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;<br> &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;<br> &lt;java.version&gt;1.8&lt;/java.version&gt;<br> &lt;/properties&gt;</blockquote><blockquote>&lt;dependencies&gt;<br> &lt;dependency&gt;<br> &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br> &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;<br> &lt;/dependency&gt;<br> &lt;dependency&gt;<br> &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br> &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;<br> &lt;scope&gt;test&lt;/scope&gt;<br> &lt;/dependency&gt;<br> &lt;/dependencies&gt;</blockquote><blockquote>&lt;build&gt;<br> &lt;plugins&gt;<br> &lt;plugin&gt;<br> &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br> &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;<br> &lt;/plugin&gt;<br> &lt;/plugins&gt;<br> &lt;/build&gt;<br>&lt;/project&gt;</blockquote><p>The <em>HelloSpringBootDockerApplication.java </em>is created under the package com.hello;</p><blockquote>package com.hello;</blockquote><blockquote>import org.springframework.boot.SpringApplication;</blockquote><blockquote>import org.springframework.boot.autoconfigure.SpringBootApplication;</blockquote><blockquote>import org.springframework.web.bind.annotation.RequestMapping;</blockquote><blockquote>import org.springframework.web.bind.annotation.RestController;</blockquote><blockquote>@SpringBootApplication</blockquote><blockquote>public class HelloSpringBootDockerApplication {</blockquote><blockquote>public static void main(String[] args) {</blockquote><blockquote>SpringApplication.run(HelloSpringBootDockerApplication.class, args);</blockquote><blockquote>}</blockquote><blockquote>}</blockquote><p>To make it rest add the <em>@RestController</em> to the <em>HelloSpringBootDockerApplication.java</em> class. Now, the class looks like this:</p><blockquote>package com.hello;</blockquote><blockquote>import org.springframework.boot.SpringApplication;<br>import org.springframework.boot.autoconfigure.SpringBootApplication;<br>import org.springframework.web.bind.annotation.RequestMapping;<br>import org.springframework.web.bind.annotation.RestController;</blockquote><blockquote>@SpringBootApplication<br><strong>@RestController</strong><br>public class HelloSpringBootDockerApplication {<br> <br> <strong>@RequestMapping(“/hello”)<br> public String sayHello() {<br> return “Hello Docker World”;<br> }</strong><br> public static void main(String[] args) {<br> SpringApplication.run(HelloSpringBootDockerApplication.class, args);<br> }<br>}</blockquote><p>If you are using Maven, execute:</p><p>./mvnw package &amp;&amp; java -jar target/hello-spring-boot-docker-0.1.0.jar</p><p>This will create jar file. Else using IDE(STS) Run as Maven Clean and Maven Install to create the jar file.</p><p>Now, your spring boot app is ready to be containerized.</p><blockquote>FROM openjdk:8-jdk-alpine</blockquote><blockquote>VOLUME /tmp</blockquote><blockquote>ARG JAR_FILE</blockquote><blockquote>ADD ${JAR_FILE} hello-spring-boot-docker-0.0.1-SNAPSHOT.jar</blockquote><blockquote>ENTRYPOINT [“java”,”-Djava.security.egd=file:/dev/./urandom”,”-jar”,”/hello-spring-boot-docker-0.0.1-SNAPSHOT.jar”]</blockquote><p>This Dockerfile is very simple, but that’s all you need to run a Spring Boot app:</p><p>just Java and a JAR file. The project JAR file is ADDed to the container as “hello-spring-boot-docker-0.0.1-SNAPSHOT.jar” and then executed in the ENTRYPOINT.</p><p>We added a VOLUME pointing to “/tmp” because that is where a Spring Boot application creates working directories for Tomcat by default. The effect is to create a temporary file on your host under “/var/lib/docker” and link it to the container under “/tmp”. This step is optional for the simple app that we wrote here, but can be necessary for other Spring Boot applications if they need to actually write in the filesystem.</p><p>To reduce <a href="https://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source">Tomcat startup time</a> we added a system property pointing to “/dev/urandom” as a source of entropy.</p><p>if you are using boot2docker you need to run it first before you do anything with the Docker command line or with the build tools (it runs a daemon process that handles the work for you in a virtual machine).</p><p>To build the image you can use some tooling for Maven or Gradle from the community (big thanks to <a href="https://github.com/palantir/gradle-docker">Palantir</a> and <a href="https://github.com/spotify/dockerfile-maven">Spotify</a> for making those tools available).</p><blockquote>&lt;properties&gt;<br> &lt;docker.image.prefix&gt;springio&lt;/docker.image.prefix&gt;<br>&lt;/properties&gt;<br>&lt;build&gt;<br> &lt;plugins&gt;<br> &lt;plugin&gt;<br> &lt;groupId&gt;com.spotify&lt;/groupId&gt;<br> &lt;artifactId&gt;dockerfile-maven-plugin&lt;/artifactId&gt;<br> &lt;version&gt;1.3.6&lt;/version&gt;<br> &lt;configuration&gt;<br> &lt;repository&gt;${docker.image.prefix}/${project.artifactId}&lt;/repository&gt;<br> &lt;buildArgs&gt;<br> &lt;JAR_FILE&gt;target/${project.build.finalName}.jar&lt;/JAR_FILE&gt;<br> &lt;/buildArgs&gt;<br> &lt;/configuration&gt;<br> &lt;/plugin&gt;<br> &lt;/plugins&gt;<br>&lt;/build&gt;</blockquote><p>The configuration specifies 3 things:</p><ul><li>The repository with the image name, which will end up here as springio/hello-spring-boot-docker</li><li>The name of the jar file, exposing the Maven configuration as a build argument for docker.</li><li>Optionally, the image tag, which ends up as latest if not specified. It can be set to the artifact id if desired.</li></ul><p>You can build a tagged docker image using the command line like this:</p><p>$ ./mvnw install dockerfile:build</p><p>You do NOT have to register with docker or publish anything to run a docker image. You still have a locally tagged image, and you can run it like this:</p><p>$ docker run -p 8080:8080 -t springio/hello-spring-boot-docker</p><p>The application is then available on <a href="http://localhost:8080/">http://localhost:8080</a> and it says “Hello Docker World”.</p><p><strong>Before you go…<br></strong>If you found this helpful, click the 👏 button or share it on Facebook so your friends can benefit too.</p><p><em>Originally published at </em><a href="https://medium.com/sudharao/dockerize-spring-boot-application-deploy-spring-boot-application-to-docker-containerize-spring-e039a1aa743a"><em>medium.com</em></a><em> on November 28, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97a640605b28" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sudharao/dockerize-spring-boot-application-97a640605b28">Dockerize Spring Boot Application</a> was originally published in <a href="https://medium.com/sudharao">Docker Spring Boot</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dockerize Spring Boot Application]]></title>
            <link>https://medium.com/sudharao/dockerize-spring-boot-application-deploy-spring-boot-application-to-docker-containerize-spring-e039a1aa743a?source=rss----ef72853bf21c---4</link>
            <guid isPermaLink="false">https://medium.com/p/e039a1aa743a</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[GoodDeeds]]></dc:creator>
            <pubDate>Tue, 28 Nov 2017 19:33:09 GMT</pubDate>
            <atom:updated>2018-03-17T19:35:24.419Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deploy Spring Boot Application to Docker/ Containerize Spring Boot App to Docker</h3><p>In this example I will be creating simple hello world Spring Boot Application and containerizing using Docker.First, let us see what are all the technologies and tool used for this example.</p><p>Technologies and Tools Used:</p><ol><li>Java 1.8, JRE 1.8 ( To download goto <a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html">http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html</a> )</li></ol><p>2. Maven 4.0.0</p><p>3. Spring Boot Version 1.5.8</p><p>4. Spring Tool Suite(Version: 3.9.1.RELEASE(to download: <a href="https://spring.io/tools/sts/all">https://spring.io/tools/sts/all</a> )</p><p>5. Docker Community Edition Version: Version 17.09.0-ce-mac35 (19611) (To Install Docker: <a href="https://docs.docker.com/docker-for-mac/install/">https://docs.docker.com/docker-for-mac/install/</a> )</p><p>The tool or IDE used to create a project is STS. Follow the steps below to create a simple hello-spring-boot-dockers project.</p><blockquote>Note: Assumption here is that one has basic knowledge on how to use Eclipse/ STS IDE and know how to create a simple Project.</blockquote><p>Step1: Right click and go to New-&gt; Spring Starter Project</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uWS3VczzOUpbRHUP." /></figure><p>Step 2: Next enter the values in the following fields: Name, Type, Java Version, Group id, Artifact Id, Version, Package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_ox2Sld6q6OsBy64." /></figure><p>Step 3: Choose Spring Boot Version. Here I am using 1.5.8. Since we are using rest we will choose Web for project dependencies, so I selected web from the list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*q4aaltxKCF4GBVcY." /></figure><p>Step 4: Click Finish. This will create Spring Boot Maven project with all the Maven, Web and Spring dependencies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Bo9-ztt6dAlOE8TQ." /></figure><p>Once complete, you workspace will have the hello-spring-boot-docker project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*e2dHweTZlwFoBudv." /></figure><p>The Maven pom.xml that is generated looks like this:</p><blockquote>&lt;?xml version=”1.0&quot; encoding=”UTF-8&quot;?&gt;<br>&lt;project xmlns=”<a href="http://maven.apache.org/POM/4.0.0">http://maven.apache.org/POM/4.0.0</a>&quot; xmlns:xsi=”<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>&quot;</blockquote><blockquote>xsi:schemaLocation=”<a href="http://maven.apache.org/POM/4.0.0">http://maven.apache.org/POM/4.0.0</a> <a href="http://maven.apache.org/xsd/maven-4.0.0.xsd">http://maven.apache.org/xsd/maven-4.0.0.xsd</a>&quot;&gt;</blockquote><blockquote>&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;</blockquote><blockquote>&lt;groupId&gt;com.hello&lt;/groupId&gt;<br> &lt;artifactId&gt;hello-spring-boot-docker&lt;/artifactId&gt;<br> &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;<br> &lt;packaging&gt;jar&lt;/packaging&gt;<br> &lt;name&gt;hello-spring-boot-docker&lt;/name&gt;<br> &lt;description&gt;Hello Spring Boot Docker Sample&lt;/description&gt;</blockquote><blockquote>&lt;parent&gt;<br> &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br> &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;<br> &lt;version&gt;1.5.8.RELEASE&lt;/version&gt;<br> &lt;relativePath/&gt; &lt;! — lookup parent from repository →<br> &lt;/parent&gt;<br> &lt;properties&gt;<br> &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;<br> &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;<br> &lt;java.version&gt;1.8&lt;/java.version&gt;<br> &lt;/properties&gt;</blockquote><blockquote>&lt;dependencies&gt;<br> &lt;dependency&gt;<br> &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br> &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;<br> &lt;/dependency&gt;<br> &lt;dependency&gt;<br> &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br> &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;<br> &lt;scope&gt;test&lt;/scope&gt;<br> &lt;/dependency&gt;<br> &lt;/dependencies&gt;</blockquote><blockquote>&lt;build&gt;<br> &lt;plugins&gt;<br> &lt;plugin&gt;<br> &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br> &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;<br> &lt;/plugin&gt;<br> &lt;/plugins&gt;<br> &lt;/build&gt;<br>&lt;/project&gt;</blockquote><p>The <em>HelloSpringBootDockerApplication.java </em>is created under the package com.hello;</p><blockquote>package com.hello;</blockquote><blockquote>import org.springframework.boot.SpringApplication;</blockquote><blockquote>import org.springframework.boot.autoconfigure.SpringBootApplication;</blockquote><blockquote>import org.springframework.web.bind.annotation.RequestMapping;</blockquote><blockquote>import org.springframework.web.bind.annotation.RestController;</blockquote><blockquote>@SpringBootApplication</blockquote><blockquote>public class HelloSpringBootDockerApplication {</blockquote><blockquote>public static void main(String[] args) {</blockquote><blockquote>SpringApplication.run(HelloSpringBootDockerApplication.class, args);</blockquote><blockquote>}</blockquote><blockquote>}</blockquote><p>To make it rest add the <em>@RestController</em> to the <em>HelloSpringBootDockerApplication.java</em> class. Now, the class looks like this:</p><blockquote>package com.hello;</blockquote><blockquote>import org.springframework.boot.SpringApplication;<br>import org.springframework.boot.autoconfigure.SpringBootApplication;<br>import org.springframework.web.bind.annotation.RequestMapping;<br>import org.springframework.web.bind.annotation.RestController;</blockquote><blockquote>@SpringBootApplication<br><strong>@RestController</strong><br>public class HelloSpringBootDockerApplication {<br> <br> <strong>@RequestMapping(“/hello”)<br> public String sayHello() {<br> return “Hello Docker World”;<br> }</strong><br> public static void main(String[] args) {<br> SpringApplication.run(HelloSpringBootDockerApplication.class, args);<br> }<br>}</blockquote><p>If you are using Maven, execute:</p><p>$ ./mvnw package &amp;&amp; java -jar target/hello-spring-boot-docker-0.1.0.jar</p><p>This will create jar file. Else using IDE(STS) Run as Maven Clean and Maven Install to create the jar file.</p><p>Now, your spring boot app is ready to be containerized.</p><h3>How to Containerize It</h3><h3>Docker has a simple <a href="https://docs.docker.com/reference/builder/">Dockerfile</a> file format that it uses to specify the “layers” of an image. So let’s go ahead and create a Dockerfile in our Spring Boot project:</h3><h3>Dockerfile</h3><blockquote>FROM openjdk:8-jdk-alpine</blockquote><blockquote>VOLUME /tmp</blockquote><blockquote>ARG JAR_FILE</blockquote><blockquote>ADD ${JAR_FILE} hello-spring-boot-docker-0.0.1-SNAPSHOT.jar</blockquote><blockquote>ENTRYPOINT [“java”,”-Djava.security.egd=file:/dev/./urandom”,”-jar”,”/hello-spring-boot-docker-0.0.1-SNAPSHOT.jar”]</blockquote><p>This Dockerfile is very simple, but that’s all you need to run a Spring Boot app:</p><p>just Java and a JAR file. The project JAR file is ADDed to the container as “hello-spring-boot-docker-0.0.1-SNAPSHOT.jar” and then executed in the ENTRYPOINT.</p><p>We added a VOLUME pointing to “/tmp” because that is where a Spring Boot application creates working directories for Tomcat by default. The effect is to create a temporary file on your host under “/var/lib/docker” and link it to the container under “/tmp”. This step is optional for the simple app that we wrote here, but can be necessary for other Spring Boot applications if they need to actually write in the filesystem.</p><p>To reduce <a href="https://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source">Tomcat startup time</a> we added a system property pointing to “/dev/urandom” as a source of entropy.</p><p>To build the image you can use some tooling for Maven or Gradle from the community</p><h3>Build a Docker Image with Maven</h3><h3>In the Maven pom.xml you should add a new plugin like this</h3><h3>pom.xml</h3><blockquote>&lt;properties&gt;<br> &lt;docker.image.prefix&gt;springio&lt;/docker.image.prefix&gt;<br>&lt;/properties&gt;<br>&lt;build&gt;<br> &lt;plugins&gt;<br> &lt;plugin&gt;<br> &lt;groupId&gt;com.spotify&lt;/groupId&gt;<br> &lt;artifactId&gt;dockerfile-maven-plugin&lt;/artifactId&gt;<br> &lt;version&gt;1.3.6&lt;/version&gt;<br> &lt;configuration&gt;<br> &lt;repository&gt;${docker.image.prefix}/${project.artifactId}&lt;/repository&gt;<br> &lt;buildArgs&gt;<br> &lt;JAR_FILE&gt;target/${project.build.finalName}.jar&lt;/JAR_FILE&gt;<br> &lt;/buildArgs&gt;<br> &lt;/configuration&gt;<br> &lt;/plugin&gt;<br> &lt;/plugins&gt;<br>&lt;/build&gt;</blockquote><p>The configuration specifies 3 things:</p><ul><li>The repository with the image name, which will end up here as springio/hello-spring-boot-docker</li><li>The name of the jar file, exposing the Maven configuration as a build argument for docker.</li><li>Optionally, the image tag, which ends up as latest if not specified. It can be set to the artifact id if desired.</li></ul><p>You can build a tagged docker image using the command line like this:</p><p>$ ./mvnw install dockerfile:build</p><p>You do NOT have to register with docker or publish anything to run a docker image. You still have a locally tagged image, and you can run it like this:</p><p>$ docker run -p 8080:8080 -t springio/hello-spring-boot-docker</p><p>The application is then available on <a href="http://localhost:8080/">http://localhost:8080</a> and it says “Hello Docker World”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e039a1aa743a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sudharao/dockerize-spring-boot-application-deploy-spring-boot-application-to-docker-containerize-spring-e039a1aa743a">Dockerize Spring Boot Application</a> was originally published in <a href="https://medium.com/sudharao">Docker Spring Boot</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>