{"id":56032,"date":"2018-03-21T15:00:57","date_gmt":"2018-03-21T13:00:57","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=56032"},"modified":"2022-07-08T15:56:24","modified_gmt":"2022-07-08T12:56:24","slug":"docker-tutorial-for-java-developers","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/","title":{"rendered":"Docker Tutorial for Java Developers"},"content":{"rendered":"<p>Let&#8217;s see this Docker Tutorial for Java Developers.<\/p>\n<p>You can also check this tutorial in the following video:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.youtube.com\/watch?v=fn5bal6I2ro\"><img decoding=\"async\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/Docker-Tutorial-fo-Beginners-1024x576.jpg\" alt=\"\" class=\"wp-image-113896\" width=\"512\" height=\"288\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/Docker-Tutorial-fo-Beginners-1024x576.jpg 1024w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/Docker-Tutorial-fo-Beginners-300x169.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/Docker-Tutorial-fo-Beginners-768x432.jpg 768w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/Docker-Tutorial-fo-Beginners.jpg 1280w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption>Docker Tutorial for Beginners &#8211; video<\/figcaption><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-1-introduction\">1. Introduction<\/h2>\n<p>So in this article, we will explain what is Docker and why do we use Docker. Going further we will learn some concepts of Docker and later, we will see how to create Dockerfile.<\/p>\n<p>We will then create Docker Image from Dockerfile. And finally, we will see how to run Docker images in the container using java code.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-2-what-is-docker\">2. What is Docker?<\/h2>\n<p>According to the official documentation of Docker, Docker is a platform for developers and sysadmins to&nbsp;develop, deploy, and run&nbsp;applications with containers. The use of Linux containers to deploy applications is called&nbsp;containerization. Containers are not new, but their use for easily deploying applications is.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-1-what-is-a-docker-container\">2.1 What is a Docker container?<\/h3>\n<p>A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings.<\/p>\n<p>Containers isolate software from its surroundings, for example, differences between development and staging environments. Also, containers help reduce conflicts between teams running different software on the same infrastructure.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-3-docker-concepts\">3. Docker Concepts<\/h2>\n<p>Let&#8217;s have a brief overview of the terms and concepts used in Docker.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-3-1-docker-image\">3.1 Docker Image<\/h3>\n<p>An&nbsp;image&nbsp;is an executable package that includes everything needed to run an application\u2013the code, a runtime, libraries, environment variables, and configuration files.<\/p>\n<p>And when you have a Docker image, you run the container by using the image. So in nutshell, a container&nbsp;is a runtime instance of an image\u2013what the image becomes in memory when executed (that is, an image with the state, or a user process).<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-3-2-docker-hub\">3.2 Docker Hub<\/h3>\n<p>Docker Hub is a cloud-based registry service which allows you to link to code repositories, build your images and test them, stores manually pushed images, and links to&nbsp;Docker Cloud so you can deploy images to your hosts. It provides a centralized resource for container image discovery, distribution and change management,&nbsp;user and team collaboration, and workflow automation throughout the development pipeline.<\/p>\n<p>So we use Docker hub to push our images and then pulling those images when required.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-3-3-dockerfile\">3.3 Dockerfile<\/h3>\n<p>Docker can build images automatically by reading the instructions from a Dockerfile. A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image. Using Docker build users can create an automated build that executes several command-line instructions in succession.<\/p>\n<p>So while creating images you have to first create a Dockerfile. In Dockerfile, we write the instructions to create the image i.e what our image will consist of the libraries and the code that our application requires.<br \/>Base Image is an image in Docker from which you can create another image. By doing this we can use the infra of the base image, inside the child image.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Dockerfile Example<\/em><\/span><\/p>\n<pre class=\"wp-block-preformatted brush:bash\">FROM java:8&nbsp; &nbsp;#using Java 8 as the base image\nCOPY .&nbsp;\/home\/user\/hello #copying the code directory to&nbsp;\/home\/user\/hello\nWORKDIR \/home\/user\/hello&nbsp; #setting&nbsp;\/home\/user\/hello as our work directory. Means code will reside here\nRUN javac printHelloImage.java&nbsp; #compiling the java class\nCMD [\"java\",\"printHelloImage\"]&nbsp; #this command will be used to run application.\n<\/pre>\n<p>Now save this file and build the image by running&nbsp;the command below:<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">Docker build -t printhello<\/pre>\n<p>Here <code>printhello<\/code> is the name of the image we want to build. Then, run this image by below command:<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">Docker run printhello<\/pre>\n<p>This was a short and simple example to create Dockerfiles. You can read more about writing Dockerfiles from here:&nbsp;<a href=\"https:\/\/docs.docker.com\/engine\/reference\/builder\/\">Dockerfiles<\/a><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2 class=\"wp-block-heading\" id=\"h-4-installing-docker\">4. Installing Docker<\/h2>\n<p>So this was the overview of Docker. Let&#8217;s install Docker now. Docker Community Edition (CE) is ideal for developers and small teams looking to get started with Docker and experimenting with container-based apps. So if you are not sure or just trying out things then you should install CE.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-4-1-installing-docker-on-ubuntu-using-the-repository\">4.1 Installing Docker on Ubuntu using the repository<\/h3>\n<ol class=\"wp-block-list\">\n<li>Update the <code>apt<\/code> package index.\n<pre class=\"brush:bash\">sudo apt-get update<\/pre>\n<\/li>\n<li>Install packages to allow <code>apt<\/code> to use a repository over HTTPS:\n<pre class=\"brush:bash\">sudo apt-get install \\\n    apt-transport-https \\\n    ca-certificates \\\n    curl \\\n    software-properties-common<\/pre>\n<\/li>\n<li>Add Docker\u2019s official GPG key:\n<pre class=\"brush:bash\">curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo apt-key add -<\/pre>\n<\/li>\n<li>Use the following command to set up the stable repository.\n<pre class=\"brush:bash\">sudo add-apt-repository \\\n   \"deb [arch=amd64] https:\/\/download.docker.com\/linux\/ubuntu \\\n   $(lsb_release -cs) \\\n   stable\"<\/pre>\n<\/li>\n<\/ol>\n<h3 class=\"wp-block-heading\" id=\"h-4-2-install-docker-ce\">4.2 Install Docker CE<\/h3>\n<ol class=\"wp-block-list\">\n<li>Update the apt package index.\n<pre class=\"brush:bash\">sudo apt-get update<\/pre>\n<\/li>\n<li>Install the latest version of Docker CE, or go to the next step to install a specific version. Any existing installation of Docker is replaced.\n<pre class=\"brush:bash\">sudo apt-get install docker-ce<\/pre>\n<\/li>\n<li>Verify that Docker CE is installed correctly by running the hello-world image\n<pre class=\"brush:bash\">sudo docker run hello-world<\/pre>\n<\/li>\n<\/ol>\n<p>For installing Docker on other Operating systems you can follow instructions from <a href=\"https:\/\/docs.Docker.com\/install\/\">here<\/a> depending on the operating system you are using.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-5-running-java-application-with-docker\">5. Running java application with Docker<\/h2>\n<p>As I explained in creating Docker file, we will create a similar Docker file and we will see how we can run java application using Docker images.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-5-1-create-dockerfile\">5.1 Create Dockerfile<\/h3>\n<p>Create directory tutorial and in this directory create a file Dockerfile. Here is the Dockerfile:<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">   FROM java:8\n   COPY . \/home\/user\/hello\n   WORKDIR \/home\/user\/hello\n   RUN javac PrintHelloDocker.java\n   CMD [\"java\",\"PrintHelloDocker\"]\n<\/pre>\n<p>So in this Dockerfile, I am using Java 8 as the base image. Then copy the current directory into <code>\/home\/vikas\/hello<\/code> (you can choose your own). Next, its setting&nbsp;<code>\/home\/vikas\/hello<\/code> as work directory. This means that Docker will look here for the code and then it will compile java file using RUN (its used to run the command inside containers). Then run the final command to run your application.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-5-2-create-java-class\">5.2 Create Java Class<\/h3>\n<p>Let&#8217;s create a simple java class to print &#8220;Hello Docker&#8221;<\/p>\n<p><span style=\"text-decoration: underline;\"><em>PrintHelloDocker.java<\/em><\/span><\/p>\n<pre class=\"wp-block-preformatted brush:java\">class PrintHelloDocker{\n public static void main(String arg[]){\n  System.out.println(\"Hello Docker\");\n }\n}\n<\/pre>\n<h3 class=\"wp-block-heading\" id=\"h-5-3-building-docker-image\">5.3 Building Docker Image<\/h3>\n<p>Now we will build our first Docker image. So the command to build a Docker image is:<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">docker build -t &lt;image name\/tag&gt;<\/pre>\n<p>So in the image tag, you can give a name so that you can clearly understand what this image does. So let&#8217;s give our image a name <code>hello<\/code> as it is printing <code>Hello Docker<\/code> when you run below command from the terminal:<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">sudo docker build -t hello<\/pre>\n<p>This will be the output:<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">Sending build context to Docker daemon  3.072kB\nStep 1\/5 : FROM java:8\n ---&gt; d23bdf5b1b1b\nStep 2\/5 : COPY . \/home\/user\/hello\n ---&gt; 63123154eb00\nRemoving intermediate container ee9310912e7d\nStep 3\/5 : WORKDIR \/home\/user\/hello\n ---&gt; 61b27b711c36\nRemoving intermediate container 1680d2cd81fd\nStep 4\/5 : RUN javac PrintHelloDocker.java\n ---&gt; Running in d7dd4bc79723\n ---&gt; d3d467723a8b\nRemoving intermediate container d7dd4bc79723\nStep 5\/5 : CMD java PrintHelloDocker\n ---&gt; Running in 9a16a6513d3d\n ---&gt; 3d9a2dcbe644\nRemoving intermediate container 9a16a6513d3d\nSuccessfully built 3d9a2dcbe644\nSuccessfully tagged hello:latest\n<\/pre>\n<p>As you can see in the output, it is using java8 as our base image. As the application needs JDK to run, this is the reason we are using it as our base image.[ulp id=&#8217;6PVIvOz3kDbYmNRn&#8217;]<\/p>\n<p>Next, it&#8217;s copying our current directory to <code>\/home\/vikas\/hello<\/code>. Then it is setting work directory i.e code location to <code>\/home\/vikas\/hello<\/code> and finally it compiles <code>PrintHelloDocker<\/code> by using:<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">RUN javac PrintHelloDocker.java<\/pre>\n<p>So our image is ready for us. Now we can run a container by using this image and let&#8217;s see if it does the task.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-5-4-running-image-in-the-container\">5.4 Running image in the container<\/h3>\n<p>The command to run a Docker image has the syntax:<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">sudo docker run &lt;image name\/tag&gt;<\/pre>\n<p>Here the image name is the name of image or tag of the image you have. As we have given the name <code>hello<\/code> to our image while building the image, we will be using <code>hello<\/code> while running our image. Run the below command:<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">sudo docker run hello<\/pre>\n<p>Here is the output:<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">Hello Docker<\/pre>\n<p>As we want to print <code>Hello Docker<\/code>, this is how you can run Docker images.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-6-docker-compose\">6. Docker Compose<\/h2>\n<p>According to Docker compose official documentation Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application\u2019s services. Then, with a single command, you create and start all the services from your configuration.<\/p>\n<p>Using Compose is basically a three-step process:<\/p>\n<ol class=\"wp-block-list\">\n<li>Define your app\u2019s environment with a&nbsp;<code class=\"highlighter-rouge\">Dockerfile<\/code>&nbsp;so it can be reproduced anywhere.<\/li>\n<li>Define the services that make up your app in&nbsp;<code class=\"highlighter-rouge\">docker-compose.yml<\/code>&nbsp;so they can be run together in an isolated environment.<\/li>\n<li>Run&nbsp;<code class=\"highlighter-rouge\">docker-compose up<\/code>&nbsp;and Compose starts and runs your entire app<\/li>\n<\/ol>\n<h3 class=\"wp-block-heading\" id=\"h-6-1-creating-docker-compose-file\">6.1 Creating Docker-Compose file<\/h3>\n<p>Suppose your application needs MYSQL and nginx. Let&#8217;s create a Docker-Compose file to run these two as services.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>docker-compose.yml<\/em><\/span><\/p>\n<pre class=\"wp-block-preformatted brush:bash\">version: '2'\nservices:\n  mysql:\n    image: mysql\n    container_name: mysqlcontainer\n    ports:\n      - 3306:3306\n    environment:\n      MYSQL_ROOT_PASSWORD: \"javageeks\"\n    volumes:\n      - \/storage\/docker\/mysql-datadir:\/var\/lib\/mysql\n  web:\n     image: nginx\n<\/pre>\n<p>In this yml we are creating two services <code>mysql<\/code> and <code>web<\/code> and starting <code>mysqlcontainer<\/code>. <code>image<\/code> is used to fetch image from the registry of Docker images. Let&#8217;s build and run our application services by running below command. Option -d is used to start in detached mode. This will start two containers. Let&#8217;s see our running containers:<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">sudo docker-compose up -d<\/pre>\n<pre class=\"wp-block-preformatted brush:bash\">sudo docker ps<\/pre>\n<pre class=\"wp-block-preformatted brush:bash\">CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES\n4b4e2c4cadbd        mysql               \"docker-entrypoint...\"   4 minutes ago       Up 3 minutes        0.0.0.0:3306-&gt;3306\/tcp   mysqlcontainer\n69758a806d13        nginx               \"nginx -g 'daemon ...\"   41 minutes ago      Up 40 minutes       80\/tcp                   gitclones_web_1\n<\/pre>\n<p>As we can see in the output <code>mysqlcontainer<\/code> and <code>gitclones_web_1<\/code> are running fine. So this is how you can set up services your application needs, by using Docker-Compose.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-7-docker-commands\">7. Docker Commands<\/h2>\n<p>Let&#8217;s have a brief overview of the commands use in Docker.<\/p>\n<ol class=\"wp-block-list\">\n<li><code>docker run<\/code> Run command in a new container.<\/li>\n<li><code>docker start<\/code> Starts one or more Docker container.<\/li>\n<li><code>docker stop<\/code> Stop one or more running Docker container.<\/li>\n<li><code>docker build<\/code> Build Docker image from Dockerfile.<\/li>\n<li><code>docker push<\/code> Push Docker image to registery.<\/li>\n<li><code>docker exec<\/code> Run a comand in a runtime container.<\/li>\n<li><code>docker search<\/code> Search for a Docker image in Docker hub.<\/li>\n<li><code>docker commit<\/code> Create new Image from a container&#8217;s changes.<\/li>\n<\/ol>\n<h2 class=\"wp-block-heading\" id=\"h-8-docker-tutorial-conclusion\">8. Docker Tutorial &#8211; Conclusion<\/h2>\n<p>So in a typical java application, you create a Dockerfile at the root directory of your code. You have to make a Dockerfile and write commands to assemble all the things your application needs. Build Docker image using this Dockerfile using:<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">docker build -t &lt;image name\/tag&gt;<\/pre>\n<p>And then run your image:<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">docker run &lt;image name\/tag&gt;<\/pre>\n<p>Also, we were running Docker images from our local machine. You can push these images to a Docker repository like Docker Hub which is a central repository for storing images. Other people can pull images from this repository and can use as the base image.<\/p>\n<p>For example in our Dockerfile, we were using java:8 as the base image so here java8 was pulled from the Docker hub because we didn&#8217;t have this image locally.<\/p>\n<p>That&#8217;s it, hope you enjoyed this post. Thank you!<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-9-download-the-source-code\">9. Download the Source Code<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>You can download the full source code of this example here: <strong><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/03\/JavaDocker.zip\">Docker Tutorial for Java Developers<\/a><\/strong><\/div>\n<p><strong>Last updated on Jan. 31st, 2022<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s see this Docker Tutorial for Java Developers. You can also check this tutorial in the following video: Docker Tutorial for Beginners &#8211; video 1. Introduction So in this article, we will explain what is Docker and why do we use Docker. Going further we will learn some concepts of Docker and later, we will &hellip;<\/p>\n","protected":false},"author":155,"featured_media":31013,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1354],"tags":[1318,1276,478],"class_list":["post-56032","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker","tag-devops","tag-docker","tag-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Docker Tutorial for Java Developers - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Docker Tutorial: It is a platform for developers and sysadmins to\u00a0develop, deploy, and run\u00a0applications with 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:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker Tutorial for Java Developers - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Docker Tutorial: It is a platform for developers and sysadmins to\u00a0develop, deploy, and run\u00a0applications with containers.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-21T13:00:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-08T12:56:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/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=\"Vikas Kumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vikas Kumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/\"},\"author\":{\"name\":\"Vikas Kumar\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/706d8eb6a246081f97db112e8df93fd9\"},\"headline\":\"Docker Tutorial for Java Developers\",\"datePublished\":\"2018-03-21T13:00:57+00:00\",\"dateModified\":\"2022-07-08T12:56:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/\"},\"wordCount\":1495,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\",\"keywords\":[\"devops\",\"docker\",\"Java\"],\"articleSection\":[\"Docker\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/\",\"name\":\"Docker Tutorial for Java Developers - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\",\"datePublished\":\"2018-03-21T13:00:57+00:00\",\"dateModified\":\"2022-07-08T12:56:24+00:00\",\"description\":\"Docker Tutorial: It is a platform for developers and sysadmins to\u00a0develop, deploy, and run\u00a0applications with containers.\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DevOps\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/devops\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Docker\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/devops\/docker\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Docker Tutorial for Java Developers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/706d8eb6a246081f97db112e8df93fd9\",\"name\":\"Vikas Kumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/03\/Vikas-Kumar_avatar_1520407443-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/03\/Vikas-Kumar_avatar_1520407443-96x96.jpg\",\"caption\":\"Vikas Kumar\"},\"description\":\"Vikas has graduated from Information Technology Department in NIT Kurukshetra. He has expertise in full-text search and works as a search engineer.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/vikas-saini-21478911b\/\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/vikas-kumar\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Docker Tutorial for Java Developers - Java Code Geeks","description":"Docker Tutorial: It is a platform for developers and sysadmins to\u00a0develop, deploy, and run\u00a0applications with 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:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/","og_locale":"en_US","og_type":"article","og_title":"Docker Tutorial for Java Developers - Java Code Geeks","og_description":"Docker Tutorial: It is a platform for developers and sysadmins to\u00a0develop, deploy, and run\u00a0applications with containers.","og_url":"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2018-03-21T13:00:57+00:00","article_modified_time":"2022-07-08T12:56:24+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","type":"image\/jpeg"}],"author":"Vikas Kumar","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Vikas Kumar","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/"},"author":{"name":"Vikas Kumar","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/706d8eb6a246081f97db112e8df93fd9"},"headline":"Docker Tutorial for Java Developers","datePublished":"2018-03-21T13:00:57+00:00","dateModified":"2022-07-08T12:56:24+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/"},"wordCount":1495,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","keywords":["devops","docker","Java"],"articleSection":["Docker"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/","url":"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/","name":"Docker Tutorial for Java Developers - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","datePublished":"2018-03-21T13:00:57+00:00","dateModified":"2022-07-08T12:56:24+00:00","description":"Docker Tutorial: It is a platform for developers and sysadmins to\u00a0develop, deploy, and run\u00a0applications with containers.","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/docker-tutorial-for-java-developers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"DevOps","item":"https:\/\/examples.javacodegeeks.com\/category\/devops\/"},{"@type":"ListItem","position":3,"name":"Docker","item":"https:\/\/examples.javacodegeeks.com\/category\/devops\/docker\/"},{"@type":"ListItem","position":4,"name":"Docker Tutorial for Java Developers"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/706d8eb6a246081f97db112e8df93fd9","name":"Vikas Kumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/03\/Vikas-Kumar_avatar_1520407443-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/03\/Vikas-Kumar_avatar_1520407443-96x96.jpg","caption":"Vikas Kumar"},"description":"Vikas has graduated from Information Technology Department in NIT Kurukshetra. He has expertise in full-text search and works as a search engineer.","sameAs":["https:\/\/www.linkedin.com\/in\/vikas-saini-21478911b\/"],"url":"https:\/\/examples.javacodegeeks.com\/author\/vikas-kumar\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/56032","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/155"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=56032"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/56032\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/31013"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=56032"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=56032"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=56032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}