{"id":81374,"date":"2018-09-04T13:00:34","date_gmt":"2018-09-04T10:00:34","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=81374"},"modified":"2018-09-03T23:07:58","modified_gmt":"2018-09-03T20:07:58","slug":"docker-existing-application-containers","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html","title":{"rendered":"Using Docker to shove an existing application into some containers"},"content":{"rendered":"<p>I have finally got round to learning how to use Docker past the level of knowing what it is and does without ever using it. This is the first post that I have attempted to use Docker in and will probably be what I refer to whenever I start a new project (for Java or Kotlin anyway).<\/p>\n<p>This will be a short post that takes an existing project (from one of my other posts) and alters it so it can run inside of containers. I doubt this post will contain anything impressive but I know it will help me in the future and maybe it will help you now.<\/p>\n<p>Before we begin, let\u2019s take a look at the existing project. Here are links to the <a href=\"https:\/\/github.com\/lankydan\/spring-boot-jms\" target=\"_blank\" rel=\"noopener\">code<\/a> and the corresponding <a href=\"https:\/\/lankydanblog.com\/2017\/06\/18\/using-jms-in-spring-boot\/\" target=\"_blank\" rel=\"noopener\">blog post<\/a>. The blog post covers all the information about the code. Here\u2019s the quick rundown so we can get on with this post. The old project is a Spring Boot application with a MongoDB database and ActiveMQ message queue. All these components are prime fodder for containerisation.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/docker-hong-kong.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81378\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/docker-hong-kong.png\" alt=\"docker\" width=\"820\" height=\"365\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/docker-hong-kong.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/docker-hong-kong-300x134.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/docker-hong-kong-768x342.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>One last comment, for the content of this post, I am assuming that you have already installed Docker or can figure out how to do so yourself.<\/p>\n<h3>Converting the Spring App<\/h3>\n<p>First up, the Spring Boot application.<\/p>\n<p>This is the only part of the project that contains our code. The rest are just images downloaded from someone else\u2019s repository. To start moving this application towards running in a container, we need to create a <code>Dockerfile<\/code> that specifies the content of an image:<\/p>\n<pre class=\"brush:java; wrap-lines:false\">FROM openjdk:8-jdk-alpine\r\nLABEL maintainer=\"Dan Newton\"\r\nADD target\/spring-boot-jms-tutorial-1.0.0.jar app.jar\r\nEXPOSE 8080\r\nENTRYPOINT [\"java\", \"-jar\", \"\/app.jar\"]<\/pre>\n<p>This takes the base image of <code>openjdk:8-jdk-alpine<\/code> which is a good starting point for the application, adds the Jar built from the application code (naming it <code>app.jar<\/code>) and exposes a port for communication between containers. The final line defines the command that executed when the image is run in a container. This is what starts the Spring application.<\/p>\n<p>To build an image from the <code>Dockerfile<\/code> run the command below (assuming you have already built the application code):<\/p>\n<pre class=\"brush:java; wrap-lines:false\">docker build -t spring-boot-jms-tutorial .<\/pre>\n<p>There is now an image named <code>spring-boot-jms-tutorial<\/code> (<code>-t<\/code> lets us define the name). This can now be used to create a container that executes the code that is packed into the image\u2019s Jar:<\/p>\n<pre class=\"brush:java; wrap-lines:false\">docker run --name application -p 4000:8080 spring-boot-jms-tutorial<\/pre>\n<p>This will create and run a container built from the <code>spring-boot-jms-tutorial<\/code> image. It names the container <code>application<\/code> and the <code>-p<\/code> property allows a port from a local machine to mapped to a port inside the container. To access port <code>8080<\/code> of the container we simply need to use port <code>4000<\/code> on our own machine.<\/p>\n<p>If we stopped this container and wanted to run it again, we should use the command:<\/p>\n<pre class=\"brush:java; wrap-lines:false\">docker start application<\/pre>\n<p>Where <code>application<\/code> is the name of the container we created before. If <code>docker run<\/code> was used again it would create another new container rather than reusing the existing one. Actually, because we provided a name to the container, running the same <code>run<\/code> command from earlier will lead to an error.<\/p>\n<p>Now the Spring application is successfully running in a container, but the logs are not looking very good. Let\u2019s have a quick look so we know what we need to do next.<\/p>\n<p>MongoDB connection failing:<\/p>\n<pre class=\"brush:java; wrap-lines:false\">Exception in monitor thread while connecting to server mongocontainer:27017\r\n\r\ncom.mongodb.MongoSocketException: mongocontainer: Name does not resolve\r\n    at com.mongodb.ServerAddress.getSocketAddress(ServerAddress.java:188) ~[mongodb-driver-core-3.6.4.jar!\/:na]\r\n    at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:59) ~[mongodb-driver-core-3.6.4.jar!\/:na]\r\n    at com.mongodb.connection.SocketStream.open(SocketStream.java:57) ~[mongodb-driver-core-3.6.4.jar!\/:na]\r\n    at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:126) ~[mongodb-driver-core-3.6.4.jar!\/:na]\r\n    at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:114) ~[mongodb-driver-core-3.6.4.jar!\/:na]\r\n    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]\r\nCaused by: java.net.UnknownHostException: mongocontainer: Name does not resolve\r\n    at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_171]\r\n    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) ~[na:1.8.0_171]\r\n    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) ~[na:1.8.0_171]\r\n    at java.net.InetAddress.getAllByName0(InetAddress.java:1276) ~[na:1.8.0_171]\r\n    at java.net.InetAddress.getAllByName(InetAddress.java:1192) ~[na:1.8.0_171]\r\n    at java.net.InetAddress.getAllByName(InetAddress.java:1126) ~[na:1.8.0_171]\r\n    at java.net.InetAddress.getByName(InetAddress.java:1076) ~[na:1.8.0_171]\r\n    at com.mongodb.ServerAddress.getSocketAddress(ServerAddress.java:186) ~[mongodb-driver-core-3.6.4.jar!\/:na]\r\n    ... 5 common frames omitted<\/pre>\n<p>ActiveMQ also isn\u2019t there:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:java; wrap-lines:false\">Could not refresh JMS Connection for destination 'OrderTransactionQueue' - retrying using FixedBackOff{interval=5000, currentAttempts=1, maxAttempts=unlimited}. \r\nCause: Could not connect to broker URL: tcp:\/\/activemqcontainer:61616. \r\nReason: java.net.UnknownHostException: activemqcontainer<\/pre>\n<p>We will sort these out in the next sections so the application can work in its entirety.<\/p>\n<p>One last thing before we move onto looking at Mongo and ActiveMQ.<\/p>\n<p>The <code>dockerfile-maven-plugin<\/code> could also be used to help with the above which builds the container as part of running <code>mvn install<\/code>. I chose not to use it since I couldn\u2019t get it to work properly with <code>docker-compose<\/code>. Below is a quick example of using the plugin:<\/p>\n<pre class=\"brush:java; wrap-lines:false\">&lt;build&gt;\r\n    &lt;plugins&gt;\r\n        &lt;plugin&gt;\r\n            &lt;groupId&gt;com.spotify&lt;\/groupId&gt;\r\n            &lt;artifactId&gt;dockerfile-maven-plugin&lt;\/artifactId&gt;\r\n            &lt;version&gt;1.4.4&lt;\/version&gt;\r\n            &lt;executions&gt;\r\n                &lt;execution&gt;\r\n                    &lt;id&gt;default&lt;\/id&gt;\r\n                    &lt;goals&gt;\r\n                        &lt;goal&gt;build&lt;\/goal&gt;\r\n                        &lt;goal&gt;push&lt;\/goal&gt;\r\n                    &lt;\/goals&gt;\r\n                &lt;\/execution&gt;\r\n            &lt;\/executions&gt;\r\n            &lt;configuration&gt;\r\n                &lt;!-- Names the image: spring-boot-jms-tutorial --&gt;\r\n                &lt;repository&gt;${project.artifactId}&lt;\/repository&gt;\r\n                &lt;buildArgs&gt;\r\n                    &lt;JAR_FILE&gt;${project.build.finalName}.jar&lt;\/JAR_FILE&gt;\r\n                &lt;\/buildArgs&gt;\r\n            &lt;\/configuration&gt;\r\n        &lt;\/plugin&gt;\r\n    &lt;\/plugins&gt;\r\n&lt;\/build&gt;<\/pre>\n<p>This then allows us to replace a few of the lines in the <code>Dockerfile<\/code>:<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">FROM openjdk:8-jdk-alpine\r\nLABEL maintainer=\"Dan Newton\"\r\nARG JAR_FILE \r\nADD target\/${JAR_FILE} app.jar\r\nEXPOSE 8080\r\nENTRYPOINT [\"java\", \"-jar\", \"\/app.jar\"]<\/pre>\n<p>Here one line has been added and one existing line is changed. The <code>JAR_FILE<\/code> argument replaces the original name of the Jar which is injected in by the plugin from the <code>pom.xml<\/code>. Make these changes and run <code>mvn install<\/code> and bam, your container is built with all the required code.<\/p>\n<h3>Using the MongoDB image<\/h3>\n<p>There is a MongoDB image ready and waiting for us to use. It is ideally named <code>mongo<\/code>\u2026 What else did you expect? All we need to do is <code>run<\/code> the image and give it\u2019s container a name:<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">docker run -d --name mongocontainer mongo<\/pre>\n<p>Adding <code>-d<\/code> will run the container in the background. The name of the container is not just for convenience as the Spring application will need it later to connect to Mongo.<\/p>\n<h3>Onto the ActiveMQ image<\/h3>\n<p>Setting up ActiveMQ is just as simple as Mongo. Run the command below:<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">docker run -d --name activemqcontainer -p 8161:8161 rmohr\/activemq<\/pre>\n<p>Here the <code>8161<\/code> ports are mapped from the container to the machine it\u2019s running on, allowing the admin console to be accessed from outside the container.<\/p>\n<h3>Tying it all together<\/h3>\n<p>If you have been running all these commands as you read through the post, you would have noticed that the <code>application<\/code> container hasn\u2019t actually been able to see the <code>mongocontainer<\/code> and <code>activemqcontainer<\/code>. This is because they are not running within the same network. Getting them to communicate is not difficult and takes only a few extra steps.<\/p>\n<p>By default, Docker creates a Bridge network when setting one up without any extra configuration. Below is how to do so:<\/p>\n<pre class=\"brush:java; wrap-lines:false\">docker network create network<\/pre>\n<p>Now that the network (named <code>network<\/code>) is created, the commands that were run previously need to be altered to create containers that will connect to the network instead. Below are the 3 commands used to create the containers in the previous sections, each altered to join the network.<\/p>\n<pre class=\" brush:java\">docker run -d --name mongocontainer --network=network mongo\r\ndocker run -d --name activemqcontainer -p 8161:8161 --network=network rmohr\/activemq\r\ndocker run --name application -p 4000:8080 --network=network spring-boot-jms-tutorial<\/pre>\n<p>Once these are all run, the application as a whole will now work. Each container can see each other. Allowing the <code>application<\/code> container to connect to MongoDB and ActiveMQ in their respective containers.<\/p>\n<p>At this point, everything is working. It runs in the same way that I remember it working when I had everything set up on my own laptop. But, this time around, nothing is setup locally\u2026 Except for Docker!<\/p>\n<h3>Docker composing it up<\/h3>\n<p>We could have stopped there, but this next section will make running everything even easier. Docker Compose allows us to effectively bring all the commands that we ran earlier together and start all the containers and their network all in a single command. Obviously, there is some more setup but in the end, I think the amount of typing actually goes down.<\/p>\n<p>To do this, we need to create a <code>docker-compose.yml<\/code> file:<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">version: '3'\r\nservices:\r\n  appcontainer:\r\n    build:\r\n      context: .\r\n      args:\r\n        JAR_FILE: \/spring-boot-jms-tutorial-1.0.0.jar\r\n    ports:\r\n    - \"4000:8080\"\r\n  activemqcontainer:\r\n    image: \"rmohr\/activemq\"\r\n    ports:\r\n    - \"8161:8161\"\r\n  mongocontainer:\r\nimage: \"mongo\"<\/pre>\n<p>Use with this version of the <code>Dockerfile<\/code>:<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">FROM openjdk:8-jdk-alpine\r\nLABEL maintainer=\"Dan Newton\"\r\nARG JAR_FILE \r\nADD target\/${JAR_FILE} app.jar\r\nEXPOSE 8080\r\nENTRYPOINT [\"java\", \"-jar\", \"\/app.jar\"]<\/pre>\n<p>This is pretty much everything that needs to be done.<\/p>\n<p><code>appcontainer<\/code> is the Spring application container built from the project\u2019s code. The <code>build<\/code> property of the container tells Docker to build the image based on the projects <code>Dockerfile<\/code> found in the project\u2019s root directory. It passes in the <code>JAR_FILE<\/code> argument to the <code>Dockerfile<\/code> moving some of the configuration into this file instead.<\/p>\n<p>The other two containers don\u2019t require much setup. As with the previous commands, the images they are built from are specified and <code>activemqcontainer<\/code> adds configuration around it\u2019s mapped ports.<\/p>\n<p>The last piece of configuration happens in the background. A network is created and all the containers are added to it. This removes the need to create a network manually.<\/p>\n<p>All that is left to do is run the <code>up<\/code> command:<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">docker-compose up<\/pre>\n<p>This will build and run all the containers. The application code image is built if necessary. Running this exact command will output all the containers logs to the console, to do this in the background add the <code>-d<\/code> flag:<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">docker-compose up -d<\/pre>\n<p>After doing so, we can have a look at the created containers and network. Running:<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">docker ps -a --format \"table {{.Image}}\\t{{.Names}}\"<\/pre>\n<p>Shows us:<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">IMAGE                          NAMES\r\nmongo                          spring-boot-jms_mongocontainer_1\r\nspring-boot-jms_appcontainer   spring-boot-jms_appcontainer_1\r\nrmohr\/activemq                 spring-boot-jms_activemqcontainer_1<\/pre>\n<p>And the network:<\/p>\n<pre class=\"brush:java\">docker network ls<\/pre>\n<p>Produces:<\/p>\n<pre class=\"brush:java; wrap-lines:false\">NETWORK ID          NAME                      DRIVER              SCOPE\r\n163edcfe5ada        spring-boot-jms_default   bridge              local<\/pre>\n<p>The names of the containers and network are prepended with the name of the project.<\/p>\n<h3>Conclusion<\/h3>\n<p>That is all there is to it\u2026 For a simple setup anyway, I\u2019m sure there is much more the Docker gods could do but I am not one of them\u2026 Yet.<\/p>\n<p>In conclusion, we took an existing application that I wrote to work locally on a machine and shoved everything into a few containers. This meant we went from a machine that needed to have everything set up, with both MongoDB and ActiveMQ installed. To instead, a machine that could skip all of this by using containers and only requiring an installation of Docker. Docker then manages all of the dependencies for us.<\/p>\n<p>We looked at how to move each part of the application into a container and then tied it all together with Docker Compose. Leaving us, at the end of all this, with a single command that can move us from absolutely nothing to everything needed to run the application.<\/p>\n<p>The code used in this post can be found on my <a href=\"https:\/\/github.com\/lankydan\/spring-boot-jms-docker\">GitHub<\/a>.<\/p>\n<p>If you found this post helpful, you can follow me on Twitter at <a href=\"http:\/\/www.twitter.com\/LankyDanDev\" target=\"_blank\" rel=\"noopener\">@LankyDanDev <\/a>to keep up with my new posts.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Java Code Geeks with permission by Dan Newton, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener\">JCG program<\/a>. See the original article here: <a href=\"https:\/\/lankydanblog.com\/2018\/09\/02\/using-docker-to-shove-an-existing-application-into-some-containers\/\" target=\"_blank\" rel=\"noopener\">Using Docker to shove an existing application into some containers<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I have finally got round to learning how to use Docker past the level of knowing what it is and does without ever using it. This is the first post that I have attempted to use Docker in and will probably be what I refer to whenever I start a new project (for Java or &hellip;<\/p>\n","protected":false},"author":12894,"featured_media":24013,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[936,59,112,30,854],"class_list":["post-81374","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","tag-docker","tag-jms","tag-mongodb","tag-spring","tag-spring-boot"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Using Docker to shove an existing application into some containers - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn more about docker? Check out our article where we Use Docker to shove an existing application into some containers!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Docker to shove an existing application into some containers - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn more about docker? Check out our article where we Use Docker to shove an existing application into some containers!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2018-09-04T10:00:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Dan Newton\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@LankyDanDev\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dan Newton\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/09\\\/docker-existing-application-containers.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/09\\\/docker-existing-application-containers.html\"},\"author\":{\"name\":\"Dan Newton\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/00ad664c44d777ebfa4d984dcf2717e2\"},\"headline\":\"Using Docker to shove an existing application into some containers\",\"datePublished\":\"2018-09-04T10:00:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/09\\\/docker-existing-application-containers.html\"},\"wordCount\":1480,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/09\\\/docker-existing-application-containers.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"keywords\":[\"Docker\",\"JMS\",\"MongoDB\",\"Spring\",\"Spring Boot\"],\"articleSection\":[\"DevOps\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/09\\\/docker-existing-application-containers.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/09\\\/docker-existing-application-containers.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/09\\\/docker-existing-application-containers.html\",\"name\":\"Using Docker to shove an existing application into some containers - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/09\\\/docker-existing-application-containers.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/09\\\/docker-existing-application-containers.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"datePublished\":\"2018-09-04T10:00:34+00:00\",\"description\":\"Interested to learn more about docker? Check out our article where we Use Docker to shove an existing application into some containers!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/09\\\/docker-existing-application-containers.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/09\\\/docker-existing-application-containers.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/09\\\/docker-existing-application-containers.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/09\\\/docker-existing-application-containers.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DevOps\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/devops\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Using Docker to shove an existing application into some containers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/00ad664c44d777ebfa4d984dcf2717e2\",\"name\":\"Dan Newton\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b5024a6405bf07e14dacc299779fc0abded33b42a05190784776429e2c76435f?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b5024a6405bf07e14dacc299779fc0abded33b42a05190784776429e2c76435f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b5024a6405bf07e14dacc299779fc0abded33b42a05190784776429e2c76435f?s=96&d=mm&r=g\",\"caption\":\"Dan Newton\"},\"sameAs\":[\"https:\\\/\\\/lankydanblog.com\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/danknewton\\\/\",\"https:\\\/\\\/x.com\\\/LankyDanDev\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/dan-newton\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using Docker to shove an existing application into some containers - Java Code Geeks","description":"Interested to learn more about docker? Check out our article where we Use Docker to shove an existing application into some containers!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html","og_locale":"en_US","og_type":"article","og_title":"Using Docker to shove an existing application into some containers - Java Code Geeks","og_description":"Interested to learn more about docker? Check out our article where we Use Docker to shove an existing application into some containers!","og_url":"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2018-09-04T10:00:34+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","type":"image\/jpeg"}],"author":"Dan Newton","twitter_card":"summary_large_image","twitter_creator":"@LankyDanDev","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Dan Newton","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html"},"author":{"name":"Dan Newton","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/00ad664c44d777ebfa4d984dcf2717e2"},"headline":"Using Docker to shove an existing application into some containers","datePublished":"2018-09-04T10:00:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html"},"wordCount":1480,"commentCount":1,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","keywords":["Docker","JMS","MongoDB","Spring","Spring Boot"],"articleSection":["DevOps"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html","url":"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html","name":"Using Docker to shove an existing application into some containers - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","datePublished":"2018-09-04T10:00:34+00:00","description":"Interested to learn more about docker? Check out our article where we Use Docker to shove an existing application into some containers!","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2018\/09\/docker-existing-application-containers.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"DevOps","item":"https:\/\/www.javacodegeeks.com\/category\/devops"},{"@type":"ListItem","position":3,"name":"Using Docker to shove an existing application into some containers"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/00ad664c44d777ebfa4d984dcf2717e2","name":"Dan Newton","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b5024a6405bf07e14dacc299779fc0abded33b42a05190784776429e2c76435f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b5024a6405bf07e14dacc299779fc0abded33b42a05190784776429e2c76435f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b5024a6405bf07e14dacc299779fc0abded33b42a05190784776429e2c76435f?s=96&d=mm&r=g","caption":"Dan Newton"},"sameAs":["https:\/\/lankydanblog.com\/","https:\/\/www.linkedin.com\/in\/danknewton\/","https:\/\/x.com\/LankyDanDev"],"url":"https:\/\/www.javacodegeeks.com\/author\/dan-newton"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/81374","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/12894"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=81374"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/81374\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/24013"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=81374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=81374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=81374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}