{"id":2986,"date":"2017-04-18T05:00:23","date_gmt":"2017-04-18T12:00:23","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=2986"},"modified":"2023-07-21T00:41:13","modified_gmt":"2023-07-21T07:41:13","slug":"docker-deploy-containerized-java-couchbase-web-application","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/","title":{"rendered":"Use Docker to Deploy a Containerized Java with Couchbase Web Application"},"content":{"rendered":"<p>Not too long ago I wrote about <a href=\"https:\/\/www.couchbase.com\/blog\/deploy-node-js-couchbase-web-application-docker-containers\/\" target=\"_blank\" rel=\"noopener\">containerizing a Node.js RESTful API and Couchbase Server<\/a> to demonstrate how easy it is to deploy web applications in a quick and reliable fashion. \u00a0In that guide we created a simple API, built a Docker image from it, deployed it as a container, and deployed Couchbase as a container. \u00a0However, I understand that not everyone is familiar with Node.js.<\/p>\n<p>Here we&#8217;re going to build a simple Java RESTful API using Spring Boot, create a <a href=\"https:\/\/www.docker.com\" target=\"_blank\" rel=\"noopener\">Docker<\/a> image from it, and deploy it as a container with <a href=\"https:\/\/www.couchbase.com\" target=\"_blank\" rel=\"noopener\">Couchbase<\/a>. \u00a0This will create a familiar environment for Java developers.<\/p>\n<p><!--more--><\/p>\n<p>This tutorial requires that you have a Docker installed and configured on your machine. \u00a0With Docker we&#8217;ll be creating custom Docker images and deploying them as containers.<\/p>\n<h2>Create a Custom Docker Image for Couchbase Server<\/h2>\n<p>Let&#8217;s start with creating a custom Docker image for Couchbase Server. \u00a0While an <a href=\"https:\/\/hub.docker.com\/_\/couchbase\/\" target=\"_blank\" rel=\"noopener\">official Couchbase image<\/a> exists, it isn&#8217;t automatically provisioned when deployed. \u00a0Our custom image will automatically provision itself upon deployment as a container.<\/p>\n<p>Somewhere on your computer create a directory with a\u00a0<strong>Dockerfile<\/strong> file and\u00a0<strong>configure.sh<\/strong> file in it. \u00a0The\u00a0<strong>Dockerfile<\/strong> file will be the blueprint for our image and the\u00a0<strong>configure.sh<\/strong> file will be the provisioning script that is run when the container is deployed.<\/p>\n<p>Open the\u00a0<strong>configure.sh<\/strong> file and include the following:<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">set -m\r\n\r\n\/entrypoint.sh couchbase-server &amp;\r\n\r\nsleep 15\r\n\r\ncurl -v -X POST https:\/\/127.0.0.1:8091\/pools\/default -d memoryQuota=512 -d indexMemoryQuota=512\r\n\r\ncurl -v https:\/\/127.0.0.1:8091\/node\/controller\/setupServices -d services=kv%2cn1ql%2Cindex\r\n\r\ncurl -v https:\/\/127.0.0.1:8091\/settings\/web -d port=8091 -d username=$COUCHBASE_ADMINISTRATOR_USERNAME -d password=$COUCHBASE_ADMINISTRATOR_PASSWORD\r\n\r\ncurl -i -u $COUCHBASE_ADMINISTRATOR_USERNAME:$COUCHBASE_ADMINISTRATOR_PASSWORD -X POST https:\/\/127.0.0.1:8091\/settings\/indexes -d 'storageMode=memory_optimized'\r\n\r\ncurl -v -u $COUCHBASE_ADMINISTRATOR_USERNAME:$COUCHBASE_ADMINISTRATOR_PASSWORD -X POST https:\/\/127.0.0.1:8091\/pools\/default\/buckets -d name=$COUCHBASE_BUCKET -d bucketType=couchbase -d ramQuotaMB=128 -d authType=sasl -d saslPassword=$COUCHBASE_BUCKET_PASSWORD\r\n\r\nsleep 15\r\n\r\ncurl -v https:\/\/127.0.0.1:8093\/query\/service -d \"statement=CREATE PRIMARY INDEX ON \\`$COUCHBASE_BUCKET\\`\"\r\n\r\nfg 1<\/pre>\n<p>Couchbase can be configured through HTTP after being deployed. \u00a0Our configuration script will specify instance resources, administrative credentials, a Bucket, and a primary index. \u00a0You&#8217;ll notice that a variety of variables are used such as\u00a0<code>$COUCHBASE_ADMINISTRATIVE_USERNAME<\/code> and\u00a0<code>$COUCHBASE_BUCKET<\/code>. \u00a0These can be passed in at runtime preventing us from having to hard-code sensitive information.<\/p>\n<p>More information on provisioning a Couchbase container via HTTP can be seen in a <a href=\"https:\/\/www.thepolyglotdeveloper.com\/2017\/04\/using-couchbase-docker-deploying-containerized-nosql-cluster\/\" target=\"_blank\" rel=\"noopener\">previous article<\/a> that I wrote on the topic.<\/p>\n<p>With the provisioning script complete, we have to finish the\u00a0<strong>Dockerfile<\/strong> file. \u00a0Open it and include the following:<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">FROM couchbase\r\n\r\nCOPY configure.sh \/opt\/couchbase\r\n\r\nCMD [\"\/opt\/couchbase\/configure.sh\"]<\/pre>\n<p>The custom Docker image will use the official Docker image as the base, copy our provisioning script during the build process, and execute it at runtime.<\/p>\n<p>To build the custom image for Couchbase, execute the following:<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">docker build -t couchbase-custom \/path\/to\/directory\/with\/dockerfile<\/pre>\n<p>In the above command\u00a0<code>couchbase-custom<\/code> is the image name and it is built from the path that contains the\u00a0<strong>Dockerfile<\/strong> file.<\/p>\n<h2>Developing a Spring Boot RESTful API with Java<\/h2>\n<p>Before we can containerize our Java application we have to build it. \u00a0Because we are using Spring Boot, we need to download a starter project. \u00a0This can easily be done from the <a href=\"https:\/\/start.spring.io\/\" target=\"_blank\" rel=\"noopener\">Spring Initializr<\/a> website.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3026 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/03\/spring-boot-initializr.png\" alt=\"Spring Boot Initializr\" width=\"2476\" height=\"1036\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/spring-boot-initializr.png 2476w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/spring-boot-initializr-300x126.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/spring-boot-initializr-1024x428.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/spring-boot-initializr-768x321.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/spring-boot-initializr-1536x643.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/spring-boot-initializr-2048x857.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/spring-boot-initializr-20x8.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/spring-boot-initializr-1320x552.png 1320w\" sizes=\"auto, (max-width: 2476px) 100vw, 2476px\" \/><\/p>\n<p>For this project I&#8217;m using\u00a0<code>com.couchbase<\/code> as my\u00a0<strong>group<\/strong> and\u00a0<code>docker<\/code> as my\u00a0<strong>artifact<\/strong>. \u00a0I also prefer Gradle, so I&#8217;m using that instead of Maven.<\/p>\n<p>Extract the downloaded project, and open the project&#8217;s\u00a0<strong>src\/main\/resources\/application.properties<\/strong> file. \u00a0In this file include the following:<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">couchbase_host=couchbase\r\ncouchbase_bucket=default\r\ncouchbase_bucket_password=<\/pre>\n<p>In the above we are assuming our host instance is called\u00a0<code>couchbase<\/code> and it has a passwordless Bucket called\u00a0<code>default<\/code>. \u00a0If you were testing locally, the host would probably be localhost instead. \u00a0In any case, all these properties are going to be defined at container runtime through environment variables.<\/p>\n<p>Now open the project&#8217;s\u00a0<strong>src\/main\/java\/com\/couchbase\/DockerApplication.java<\/strong> file. \u00a0Here we&#8217;re going to load our properties and define our endpoints. \u00a0Open this file and include the following Java code:<\/p>\n<pre class=\"lang:default highlight:0 decode:true\">package com.couchbase;\r\n\r\nimport com.couchbase.client.java.Bucket;\r\nimport com.couchbase.client.java.Cluster;\r\nimport com.couchbase.client.java.CouchbaseCluster;\r\nimport com.couchbase.client.java.query.*;\r\nimport com.couchbase.client.java.query.consistency.ScanConsistency;\r\nimport com.couchbase.client.java.document.json.JsonObject;\r\nimport com.couchbase.client.java.document.JsonDocument;\r\nimport org.springframework.beans.factory.annotation.Value;\r\nimport org.springframework.boot.SpringApplication;\r\nimport org.springframework.boot.autoconfigure.*;\r\nimport org.springframework.context.annotation.*;\r\nimport org.springframework.http.*;\r\nimport org.springframework.web.bind.annotation.*;\r\nimport javax.servlet.*;\r\nimport javax.servlet.http.HttpServletResponse;\r\nimport java.util.*;\r\nimport java.util.concurrent.TimeUnit;\r\n\r\n@SpringBootApplication\r\n@RestController\r\n@RequestMapping(\"\/\")\r\npublic class DockerApplication {\r\n\r\n    @Value(\"${couchbase_host}\")\r\n    private String hostname;\r\n\r\n    @Value(\"${couchbase_bucket}\")\r\n    private String bucket;\r\n\r\n    @Value(\"${couchbase_bucket_password}\")\r\n    private String password;\r\n\r\n    public @Bean\r\n    Cluster cluster() {\r\n        return CouchbaseCluster.create(hostname);\r\n    }\r\n\r\n    public @Bean\r\n    Bucket bucket() {\r\n        return cluster().openBucket(bucket, password);\r\n    }\r\n\r\n    @RequestMapping(value=\"\/\", method= RequestMethod.GET)\r\n    public String root() {\r\n        return \"Try visiting the `\/get` or `\/save` endpoints\";\r\n    }\r\n\r\n\r\n    @RequestMapping(value=\"\/get\", method= RequestMethod.GET)\r\n    public Object get() {\r\n        String query = \"SELECT `\" + bucket().name() + \"`.* FROM `\" + bucket().name() + \"`\";\r\n        return bucket().async().query(N1qlQuery.simple(query, N1qlParams.build().consistency(ScanConsistency.REQUEST_PLUS)))\r\n                .flatMap(AsyncN1qlQueryResult::rows)\r\n                .map(result -&gt; result.value().toMap())\r\n                .toList()\r\n                .timeout(10, TimeUnit.SECONDS)\r\n                .toBlocking()\r\n                .single();\r\n    }\r\n\r\n    @RequestMapping(value=\"\/save\", method=RequestMethod.POST)\r\n    public Object save(@RequestBody String json) {\r\n        JsonObject jsonData = JsonObject.fromJson(json);\r\n        JsonDocument document = JsonDocument.create(UUID.randomUUID().toString(), jsonData);\r\n        bucket().insert(document);\r\n        return new ResponseEntity&lt;String&gt;(json, HttpStatus.OK);\r\n    }\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tSpringApplication.run(DockerApplication.class, args);\r\n\t}\r\n}<\/pre>\n<p>Not too much is happening in the above. \u00a0Much of it is boilerplate code and import statements. \u00a0Because the goal of this article isn&#8217;t in regards to using Java with Couchbase, I won&#8217;t explain each part of the code. \u00a0Instead know that it has three endpoints, one of which will get all documents in the Bucket and one of which will save new documents to Couchbase.<\/p>\n<p>If you&#8217;re using Gradle like I am, you need to change the\u00a0<strong>build.gradle<\/strong> file. \u00a0It needs to have a task created and dependencies added. \u00a0Your\u00a0<strong>build.gradle<\/strong> file should look something like this:<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">buildscript {\r\n\text {\r\n\t\tspringBootVersion = '1.5.2.RELEASE'\r\n\t}\r\n\trepositories {\r\n\t\tmavenCentral()\r\n\t}\r\n\tdependencies {\r\n\t\tclasspath(\"org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}\")\r\n\t}\r\n}\r\n\r\napply plugin: 'java'\r\napply plugin: 'eclipse'\r\napply plugin: 'org.springframework.boot'\r\n\r\nversion = '0.0.1-SNAPSHOT'\r\nsourceCompatibility = 1.8\r\n\r\nrepositories {\r\n\tmavenCentral()\r\n}\r\n\r\n\r\ndependencies {\r\n    compile('org.springframework.boot:spring-boot-starter-web')\r\n\tcompile('org.springframework:spring-tx')\r\n\tcompile('org.springframework.security:spring-security-core')\r\n\tcompile('com.couchbase.client:java-client')\r\n\ttestCompile('org.springframework.boot:spring-boot-starter-test')\r\n}\r\n\r\ntask(run, dependsOn: 'classes', type: JavaExec) {\r\n    main = 'com.couchbase.DockerApplication'\r\n    classpath = sourceSets.main.runtimeClasspath\r\n}<\/pre>\n<p>To build the application, execute the following:<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">gradle build -x test<\/pre>\n<p>Now you&#8217;ll have a JAR file to be used in our Docker image.<\/p>\n<h2>Build a Custom Docker Image for the Spring Boot Application<\/h2>\n<p>Building a custom image will require that we have a\u00a0<strong>Dockerfile<\/strong> file in place. \u00a0At the base of your Java project, add a\u00a0<strong>Dockerfile<\/strong> file and include the following:<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">FROM openjdk:8\r\n\r\nCOPY .\/build\/libs\/java-project-0.0.1-SNAPSHOT.jar spring-boot.jar\r\n\r\nCMD java -jar spring-boot.jar<\/pre>\n<p>In the above we&#8217;re using the official OpenJDK image as our base and we&#8217;re copying our JAR into the image at build time. \u00a0At deployment, the JAR is executed.<\/p>\n<p>To build this image, execute the following:<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">docker build -t spring-boot-custom \/path\/to\/directory\/with\/dockerfile<\/pre>\n<p>The above command should look familiar. \u00a0We&#8217;re creating a\u00a0<code>spring-boot-custom<\/code> image using the blueprint found in the directory of our\u00a0<strong>Dockerfile<\/strong> file.<\/p>\n<p>For more information on creating custom Docker images, you can visit a previous article I wrote called, <a href=\"https:\/\/www.thepolyglotdeveloper.com\/2017\/03\/build-custom-docker-image-containerized-web-application\/\" target=\"_blank\" rel=\"noopener\">Build a Custom Docker Image for Your Containerized Web Application<\/a>.<\/p>\n<h2>Deploying the Couchbase and the Spring Boot Images as Containers<\/h2>\n<p>There are a few options when it comes to deploying our images. \u00a0We can use a Compose file or deploy them as vanilla containers. \u00a0I find Compose to be a cleaner approach so we&#8217;ll use that.<\/p>\n<p>Somewhere on your computer create a\u00a0<strong>docker-compose.yml<\/strong> file and include the following:<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">version: '2'\r\n\r\nservices:\r\n    couchbase:\r\n        image: couchbase-custom\r\n        ports:\r\n            - 8091:8091\r\n            - 8092:8092\r\n            - 8093:8093\r\n        environment:\r\n            - COUCHBASE_ADMINISTRATOR_USERNAME=Administrator\r\n            - COUCHBASE_ADMINISTRATOR_PASSWORD=password\r\n            - COUCHBASE_BUCKET=default\r\n            - COUCHBASE_BUCKET_PASSWORD=\r\n\r\n    spring-boot:\r\n        image: spring-boot-custom\r\n        ports:\r\n            - 8080:8080\r\n        environment:\r\n            - COUCHBASE_HOST=couchbase\r\n            - COUCHBASE_BUCKET=default\r\n            - COUCHBASE_BUCKET_PASSWORD=\r\n        restart: always<\/pre>\n<p>In the above file we are defining the custom images that we built and we are doing port mapping to the host machine. \u00a0What is particularly interesting is the\u00a0<code>environment<\/code> options. \u00a0These match the variables that we have in our\u00a0<strong>application.properties<\/strong> and\u00a0<strong>configure.sh<\/strong> files.<\/p>\n<p>To deploy our containers with Compose, execute the following:<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">docker-compose run -d --service-ports --name couchbase couchbase\r\ndocker-compose run -d --service-ports --name spring-boot spring-boot<\/pre>\n<p>Something to note about the above commands. \u00a0Couchbase does not deploy instantly. \u00a0You&#8217;ll need to wait until it is completely launched before you deploy the Java application. \u00a0After both applications are launched, check them out by navigating to the Java application in your web browser.<\/p>\n<h2>Conclusion<\/h2>\n<p>You just saw how to create custom <a href=\"https:\/\/www.docker.com\" target=\"_blank\" rel=\"noopener\">Docker<\/a> images for a Spring Boot application and Couchbase Server. \u00a0After deploying each as containers they will be able to communicate to each other which is incredible convenient for maintenance.<\/p>\n<p>If you&#8217;re interested in seeing this done with Node.js, check out the <a href=\"https:\/\/www.couchbase.com\/blog\/deploy-node-js-couchbase-web-application-docker-containers\/\" target=\"_blank\" rel=\"noopener\">previous article<\/a> I wrote on the topic. \u00a0If you&#8217;re interested in learning more about the Java SDK for Couchbase, check out the <a href=\"https:\/\/www.couchbase.com\/developers\/\" target=\"_blank\" rel=\"noopener\">Couchbase Developer Portal<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Not too long ago I wrote about containerizing a Node.js RESTful API and Couchbase Server to demonstrate how easy it is to deploy web applications in a quick and reliable fashion. \u00a0In that guide we created a simple API, built [&hellip;]<\/p>\n","protected":false},"author":63,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1815,1816,1818],"tags":[1897,1520,1519,1776],"ppma_author":[9032],"class_list":["post-2986","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-best-practices-and-tutorials","category-couchbase-server","category-java","tag-containerized","tag-containers","tag-docker","tag-web-application"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Use Docker to Deploy a Containerized Java with Couchbase Web Application<\/title>\n<meta name=\"description\" content=\"Learn how to deploy a containerized Java RESTful API and Couchbase NoSQL database using Docker and custom, hand-crafted, images.\" \/>\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.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Use Docker to Deploy a Containerized Java with Couchbase Web Application\" \/>\n<meta property=\"og:description\" content=\"Learn how to deploy a containerized Java RESTful API and Couchbase NoSQL database using Docker and custom, hand-crafted, images.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/thepolyglotdeveloper\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-18T12:00:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-21T07:41:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/03\/spring-boot-initializr.png\" \/>\n<meta name=\"author\" content=\"Nic Raboy, Developer Advocate, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@nraboy\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nic Raboy, Developer Advocate, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/\"},\"author\":{\"name\":\"Nic Raboy, Developer Advocate, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1\"},\"headline\":\"Use Docker to Deploy a Containerized Java with Couchbase Web Application\",\"datePublished\":\"2017-04-18T12:00:23+00:00\",\"dateModified\":\"2023-07-21T07:41:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/\"},\"wordCount\":1049,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"keywords\":[\"containerized\",\"containers\",\"docker\",\"web application\"],\"articleSection\":[\"Best Practices and Tutorials\",\"Couchbase Server\",\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/\",\"name\":\"Use Docker to Deploy a Containerized Java with Couchbase Web Application\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2017-04-18T12:00:23+00:00\",\"dateModified\":\"2023-07-21T07:41:13+00:00\",\"description\":\"Learn how to deploy a containerized Java RESTful API and Couchbase NoSQL database using Docker and custom, hand-crafted, images.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Use Docker to Deploy a Containerized Java with Couchbase Web Application\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1\",\"name\":\"Nic Raboy, Developer Advocate, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/8863514d8bed0cf6080f23db40e00354\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g\",\"caption\":\"Nic Raboy, Developer Advocate, Couchbase\"},\"description\":\"Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in Java, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Apache Cordova. Nic writes about his development experiences related to making web and mobile development easier to understand.\",\"sameAs\":[\"https:\/\/www.thepolyglotdeveloper.com\",\"https:\/\/www.facebook.com\/thepolyglotdeveloper\",\"https:\/\/x.com\/nraboy\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/nic-raboy-2\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Use Docker to Deploy a Containerized Java with Couchbase Web Application","description":"Learn how to deploy a containerized Java RESTful API and Couchbase NoSQL database using Docker and custom, hand-crafted, images.","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.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/","og_locale":"en_US","og_type":"article","og_title":"Use Docker to Deploy a Containerized Java with Couchbase Web Application","og_description":"Learn how to deploy a containerized Java RESTful API and Couchbase NoSQL database using Docker and custom, hand-crafted, images.","og_url":"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/","og_site_name":"The Couchbase Blog","article_author":"https:\/\/www.facebook.com\/thepolyglotdeveloper","article_published_time":"2017-04-18T12:00:23+00:00","article_modified_time":"2023-07-21T07:41:13+00:00","og_image":[{"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/03\/spring-boot-initializr.png","type":"","width":"","height":""}],"author":"Nic Raboy, Developer Advocate, Couchbase","twitter_card":"summary_large_image","twitter_creator":"@nraboy","twitter_misc":{"Written by":"Nic Raboy, Developer Advocate, Couchbase","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/"},"author":{"name":"Nic Raboy, Developer Advocate, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1"},"headline":"Use Docker to Deploy a Containerized Java with Couchbase Web Application","datePublished":"2017-04-18T12:00:23+00:00","dateModified":"2023-07-21T07:41:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/"},"wordCount":1049,"commentCount":1,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","keywords":["containerized","containers","docker","web application"],"articleSection":["Best Practices and Tutorials","Couchbase Server","Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/","url":"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/","name":"Use Docker to Deploy a Containerized Java with Couchbase Web Application","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2017-04-18T12:00:23+00:00","dateModified":"2023-07-21T07:41:13+00:00","description":"Learn how to deploy a containerized Java RESTful API and Couchbase NoSQL database using Docker and custom, hand-crafted, images.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/docker-deploy-containerized-java-couchbase-web-application\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Use Docker to Deploy a Containerized Java with Couchbase Web Application"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1","name":"Nic Raboy, Developer Advocate, Couchbase","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/8863514d8bed0cf6080f23db40e00354","url":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g","caption":"Nic Raboy, Developer Advocate, Couchbase"},"description":"Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in Java, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Apache Cordova. Nic writes about his development experiences related to making web and mobile development easier to understand.","sameAs":["https:\/\/www.thepolyglotdeveloper.com","https:\/\/www.facebook.com\/thepolyglotdeveloper","https:\/\/x.com\/nraboy"],"url":"https:\/\/www.couchbase.com\/blog\/author\/nic-raboy-2\/"}]}},"authors":[{"term_id":9032,"user_id":63,"is_guest":0,"slug":"nic-raboy-2","display_name":"Nic Raboy, Developer Advocate, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g","author_category":"","last_name":"Raboy","first_name":"Nic","job_title":"","user_url":"https:\/\/www.thepolyglotdeveloper.com","description":"Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in Java, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Apache Cordova. Nic writes about his development experiences related to making web and mobile development easier to understand."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2986","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=2986"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2986\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=2986"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=2986"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=2986"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=2986"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}