{"id":36986,"date":"2016-05-17T11:00:48","date_gmt":"2016-05-17T08:00:48","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=36986"},"modified":"2019-03-29T14:16:34","modified_gmt":"2019-03-29T12:16:34","slug":"docker-tutorial-beginners","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/","title":{"rendered":"Docker Tutorial for Beginners"},"content":{"rendered":"<p>In this article we are going to explain the main features of Docker. We are going to briefly explain why containers are necessary, which are the main commands to use and how to use Docker in our integration tests. The following table shows an overview of the whole article:<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;\n<\/p>\n<div class=\"toc\">\n<h3>Table Of Contents<\/h3>\n<dl>\n<dt><a href=\"#motivation\">1. Why do we need Docker?<\/a><\/dt>\n<dt><a href=\"#concepts\">2. Machines, Images and Containers<\/a><\/dt>\n<dd>\n<dl>\n<dt><a href=\"#install\">2.1. Installing docker and docker-machine<\/a><\/dt>\n<\/dl>\n<\/dd>\n<dt><a href=\"#commands\">3. Understanding the commands<\/a><\/dt>\n<dd>\n<dl>\n<dt><a href=\"#machine\">3.1 Creating a machine<\/a><\/dt>\n<\/dl>\n<dl>\n<dt><a href=\"#image\">3.2 Creating an image<\/a><\/dt>\n<\/dl>\n<dl>\n<dt><a href=\"#container\">3.3 Creating a container<\/a><\/dt>\n<\/dl>\n<dl>\n<dt><a href=\"#clean\">3.4 Cleaning the environment<\/a><\/dt>\n<\/dl>\n<\/dd>\n<dt><a href=\"#tests\">4.Running integration tests with Maven<\/a><\/dt>\n<dd>\n<dl>\n<dt><a href=\"#maven\">4.1 Maven configuration<\/a><\/dt>\n<\/dl>\n<dl>\n<dt><a href=\"#junit\">4.2 Creating the tests<\/a><\/dt>\n<\/dl>\n<dl>\n<dt><a href=\"#verify\">4.3 Running the tests<\/a><\/dt>\n<\/dl>\n<\/dd>\n<dt><a href=\"#sources\">5.Download the source code<\/a><\/dt>\n<\/dl>\n<\/div>\n<h2><a name=\"motivation\"><\/a>1. Why do we need Docker?<\/h2>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/dockerlogo.jpg\"><img decoding=\"async\" class=\"alignleft wp-image-37165 size-medium\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/dockerlogo-300x295.jpg\" alt=\"docker\" width=\"300\" height=\"295\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/dockerlogo-300x295.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/dockerlogo-70x70.jpg 70w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/dockerlogo.jpg 700w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>Docker is a tool to avoid the usual headaches of conflicts, dependencies and inconsistent environments, which is an important problem for distributed applications, where we need to install or upgrade several nodes with the same configuration.<\/p>\n<p>Docker is a container manager, which means that is able to create and execute containers that represent specific runtime environments for your software. In contrast with virtual machines like VirtualBox, Docker uses resource isolation features of the Linux kernel to allow independent \u201ccontainers\u201d to run within a single Linux instance, avoiding the overhead of starting and maintaining virtual machines. A computer with docker can run multiple containers at the same time.<\/p>\n<p>Therefore, the automation of Docker mainly offers facilities for integration tests and continuous delivery.<\/p>\n<h2><a name=\"concepts\"><\/a>2. Machines, Images and Containers<\/h2>\n<p>In order to use docker, it is important to have clear some vocabulary. Docker distinguishes three important concepts: docker machines, docker images and containers.<\/p>\n<p>Docker containers are executions of an specific runtime environment. For example, to simulate a machine with an specific database up. These runtime environments are called Docker images, which are the result of executing the set of commands that appear in an specific script-like file called <code>Dockerfile<\/code>. Therefore, Docker allow having multiple containers of an specific Docker image. These could be compared with the concepts of program and process. Indeed, containers like processes, can be created, stopped, died, or running.<\/p>\n<p>Docker machines are local (and virtual) machines or remote machines(e.g in a cloud such as Amazon AWS or DigitalOcean) with a docker running. Like physical machines, docker machines has an specific IP address. Each docker machine can manage multiple docker images and containers. From our own personal computer, the docker-machine command, allow us connecting to all our docker machines to manage their containers and images.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/docker-mchine-me.jpg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-37196\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/docker-mchine-me.jpg\" alt=\"docker concepts\" width=\"637\" height=\"477\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/docker-mchine-me.jpg 637w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/docker-mchine-me-300x225.jpg 300w\" sizes=\"(max-width: 637px) 100vw, 637px\" \/><\/a><\/p>\n<h3><a name=\"install\"><\/a>2.1. Installing docker and docker-machine<\/h3>\n<p>Follow the next steps to install docker and docker machine<\/p>\n<ul>\n<li>Download and install the docker binary file from <a href=\"https:\/\/docs.docker.com\/installation\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.Once, you have followed the installation instructions, you should be able to run the following command.<br \/>\n<span style=\"text-decoration: underline;\"><em>Docker installation test<\/em><\/span><\/p>\n<pre class=\"brush:bash\">$ docker run ubuntu:14.04 \/bin\/echo 'It works!'\nIt works!\n<\/pre>\n<\/li>\n<li>Download the Docker Machine binary and update your <code>PATH<\/code>.If you are running OS X or Linux:<br \/>\n<span style=\"text-decoration: underline;\"><em>Unix Docker Machine installation<\/em><\/span><\/p>\n<pre class=\"brush:bash\">$ curl -L https:\/\/github.com\/docker\/machine\/releases\/download\/v0.6.0\/docker-machine-`uname -s`-`uname -m` &gt; \/usr\/local\/bin\/docker-machine &amp;&amp; \\\nchmod +x \/usr\/local\/bin\/docker-machine\n<\/pre>\n<p>If you are running Windows with git bash<br \/>\n<span style=\"text-decoration: underline;\"><em>Windows Docker Machine installation<\/em><\/span><\/p>\n<pre class=\"brush:bash\">$ if [[ ! -d \"$HOME\/bin\" ]]; then mkdir -p \"$HOME\/bin\"; fi &amp;&amp; \\\ncurl -L https:\/\/github.com\/docker\/machine\/releases\/download\/v0.6.0\/docker-machine-Windows-x86_64.exe &gt; \"$HOME\/bin\/docker-machine.exe\" &amp;&amp; \\\nchmod +x \"$HOME\/bin\/docker-machine.exe\"\n<\/pre>\n<p>Otherwise, simply use the installer from the <a href=\"https:\/\/github.com\/docker\/machine\/releases\/\" target=\"_blank\" rel=\"noopener noreferrer\">Docker official releases<\/a>.<\/li>\n<\/ul>\n<h2><a name=\"commands\"><\/a>3. Understanding the commands<\/h2>\n<p>There are many docker commands. In fact, if we run simply <code>docker<\/code> from our terminal, we can see all the available commands.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Docker commands<\/em><\/span><\/p>\n<pre class=\"brush:bash;wrap-lines:false\">Commands:\n    attach    Attach to a running container\n    build     Build an image from a Dockerfile\n    commit    Create a new image from a container's changes\n    cp        Copy files\/folders from a container to a HOSTDIR or to STDOUT\n    create    Create a new container\n    diff      Inspect changes on a container's filesystem\n    events    Get real time events from the server\n    exec      Run a command in a running container\n    export    Export a container's filesystem as a tar archive\n    history   Show the history of an image\n    images    List images\n    import    Import the contents from a tarball to create a filesystem image\n    info      Display system-wide information\n    inspect   Return low-level information on a container or image\n    kill      Kill a running container\n    load      Load an image from a tar archive or STDIN\n    login     Register or log in to a Docker registry\n    logout    Log out from a Docker registry\n    logs      Fetch the logs of a container\n    pause     Pause all processes within a container\n    port      List port mappings or a specific mapping for the CONTAINER\n    ps        List containers\n    pull      Pull an image or a repository from a registry\n    push      Push an image or a repository to a registry\n    rename    Rename a container\n    restart   Restart a running container\n    rm        Remove one or more containers\n    rmi       Remove one or more images\n    run       Run a command in a new container\n    save      Save an image(s) to a tar archive\n    search    Search the Docker Hub for images\n    start     Start one or more stopped containers\n    stats     Display a live stream of container(s) resource usage statistics\n    stop      Stop a running container\n    tag       Tag an image into a repository\n    top       Display the running processes of a container\n    unpause   Unpause all processes within a container\n    version   Show the Docker version information\n    wait      Block until a container stops, then print its exit code\n\nRun 'docker COMMAND --help' for more information on a command.\n<\/pre>\n<p>In this section, we will see how to manage docker machines, how to pull a docker image using an specific docker machine and how to create a container for such docker image.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h3><a name=\"machine\"><\/a>3.1 Creating a machine<\/h3>\n<p>First of all, we will list the set of available docker machines with the following command:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>List Docker Machines<\/em><\/span><\/p>\n<pre class=\"brush:bash\">docker-machine ls\n<\/pre>\n<p>In case of not having any machine, we are going to create a new one as follows:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Docker installation test<\/em><\/span><\/p>\n<pre class=\"brush:bash\">docker-machine create --driver virtualbox default\n<\/pre>\n<p>Notice that in order to create a docker machine, we need to specify a driver, which will determine if it is a virtual machine, in this case virtual box, or if it is a connection to docker running in an external machine.<\/p>\n<h3><a name=\"image\"><\/a>3.2 Creating an image<\/h3>\n<p>Docker images are created in an specific docker machine. In order to define the docker machine that we want to use, we need to run the following command:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Select docker machine<\/em><\/span><\/p>\n<pre class=\"brush:bash\">eval \"$(docker-machine env default)\"\n<\/pre>\n<p>In order to check the effects, list the available docker machines again. At this moment, a new machine should appear with a new IP address (192.168.99.100) and contains an asterisk in the <code>ACTIVE<\/code> column.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Active Docker Machine<\/em><\/span><\/p>\n<pre class=\"brush:bash\">NAME            ACTIVE   DRIVER         STATE     URL                          SWARM\ndefault           *       virtualbox     Running   tcp:\/\/192.168.99.100:2376    \n<\/pre>\n<p>Docker images are the binary files of runtime environments. The contents of a docker image are the result of executing the set of instructions that appear in a plain text file called <code>Dockerfile<\/code>. However, in order to avoid building docker images from Dockerfiles over and over again, there is an online repository for docker images called <a href=\"https:\/\/hub.docker.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Docker Hub<\/a>.<\/p>\n<p>For example, in order to pull a MongoDB image, we only need to execute the docker pull command as follows:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Docker pull command<\/em><\/span><\/p>\n<pre class=\"brush:bash\">docker pull mongo\n<\/pre>\n<p>In order to see the installed docker images in our docker machine, use the following command. Notice that a new entry appears with the Mongo image. Each image has a unique identifier of the docker image for our machine called <code>IMAGE ID<\/code>.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>List Docker Images<\/em><\/span><\/p>\n<pre class=\"brush:bash\">docker images\n<\/pre>\n<p>If you are interested to understand how to create a <code>Dockerfile<\/code>, we strongly recommend follow <a href=\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/introduction-docker-java-developers\/\" target=\"_blank\" rel=\"noopener noreferrer\">this<\/a> example.<\/p>\n<h3><a name=\"container\"><\/a>3.3 Creating a container<\/h3>\n<p>Docker containers are executions of docker images. In order to create a container from an image, we use the command docker run. For example:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>List Docker Images<\/em><\/span><\/p>\n<pre class=\"brush:bash\">docker run mongo\n<\/pre>\n<p>After that, we can check the list of containers, with the following instruction.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>List docker containers<\/em><\/span><\/p>\n<pre class=\"brush:bash\">docker ps -a\n<\/pre>\n<p>Notice that our container has an identifier too, called <code>CONTAINER ID<\/code>. We will use it later.<\/p>\n<p>The IP address to connect to this container from our application is the IP of our docker machine (192.168.99.100).<\/p>\n<h3><a name=\"clean\"><\/a>3.4 Cleaning the environment<\/h3>\n<p>At this point we have downloaded a docker machine and we have started a docker container. In order to stop and remove the container and the image we need to execute the following instructions:<\/p>\n<p>Stop the container:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Stop Docker Container<\/em><\/span><\/p>\n<pre class=\"brush:bash\">docker stop #containerId\n<\/pre>\n<p>Remove the container:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Remove Docker Container<\/em><\/span><\/p>\n<pre class=\"brush:bash\">docker rm #containerId\n<\/pre>\n<p>Remove the docker image:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Remove Docker Image<\/em><\/span><\/p>\n<pre class=\"brush:bash\">docker rmi #imageId\n<\/pre>\n<h2><a name=\"tests\"><\/a>4.Running integration tests with Maven<\/h2>\n<p>There are different approaches to design integration tests with Docker. In this example, we will design a Maven project, which before executing JUnit tests, it automatically starts a MongoDB Docker container.<\/p>\n<h3><a name=\"maven\"><\/a>4.1 Maven configuration<\/h3>\n<p>First of all, copy this <code>pom.xml<\/code> file. We are going to use the <code>docker-maven-plugin<\/code> to automatically load the defined Docker images and create a container before running the integration tests. In order to support integration tests, we use the <code>maven-failsafe-plugin<\/code>.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>pom.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n\txsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\n\t&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n\n    &lt;groupId&gt;javacodegeeks&lt;\/groupId&gt;\n\t&lt;artifactId&gt;javacodegeeks&lt;\/artifactId&gt;\n\t&lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;\n\t&lt;packaging&gt;jar&lt;\/packaging&gt;\n\n\n    &lt;properties&gt;\n        &lt;project.build.sourceEncoding&gt;UTF-8&lt;\/project.build.sourceEncoding&gt;\n        &lt;project.build.resourceEncoding&gt;UTF-8&lt;\/project.build.resourceEncoding&gt;\n        &lt;maven.compile.encoding&gt;UTF-8&lt;\/maven.compile.encoding&gt;\n    &lt;\/properties&gt;\n\n    &lt;build&gt;\n        &lt;plugins&gt;\n         \n            &lt;plugin&gt;\n                &lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;\n                &lt;version&gt;2.1&lt;\/version&gt;\n                &lt;configuration&gt;\n                    &lt;source&gt;1.8&lt;\/source&gt;\n                    &lt;target&gt;1.8&lt;\/target&gt;\n                    &lt;encoding&gt;UTF-8&lt;\/encoding&gt;\n                &lt;\/configuration&gt;\n            &lt;\/plugin&gt;\n            &lt;plugin&gt;\n                &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\n                &lt;artifactId&gt;maven-failsafe-plugin&lt;\/artifactId&gt;\n                &lt;version&gt;2.19.1&lt;\/version&gt;\n                &lt;configuration&gt;\n                    &lt;includes&gt;\n                        &lt;include&gt;**\/IntegrationTest.java&lt;\/include&gt;\n                    &lt;\/includes&gt;\n                &lt;\/configuration&gt;\n                &lt;executions&gt;\n                    &lt;execution&gt;\n                        &lt;id&gt;integration-test&lt;\/id&gt;\n                        &lt;goals&gt;\n                            &lt;goal&gt;integration-test&lt;\/goal&gt;\n                        &lt;\/goals&gt;\n                    &lt;\/execution&gt;\n                    &lt;execution&gt;\n                        &lt;id&gt;verify&lt;\/id&gt;\n                        &lt;goals&gt;\n                            &lt;goal&gt;verify&lt;\/goal&gt;\n                        &lt;\/goals&gt;\n                    &lt;\/execution&gt;\n                &lt;\/executions&gt;\n            &lt;\/plugin&gt;\n            &lt;!-- Tell surefire to skip test, we are using the failsafe plugin --&gt;\n            &lt;plugin&gt;\n                &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\n                &lt;artifactId&gt;maven-surefire-plugin&lt;\/artifactId&gt;\n                &lt;version&gt;2.10&lt;\/version&gt;\n                &lt;configuration&gt;\n                    &lt;skip&gt;true&lt;\/skip&gt;\n                &lt;\/configuration&gt;\n            &lt;\/plugin&gt;\n            &lt;plugin&gt;\n                &lt;groupId&gt;io.fabric8&lt;\/groupId&gt;\n                &lt;artifactId&gt;docker-maven-plugin&lt;\/artifactId&gt;\n                &lt;version&gt;0.15.0&lt;\/version&gt;\n                &lt;configuration&gt;\n                    &lt;logDate&gt;default&lt;\/logDate&gt;\n                    &lt;autoPull&gt;true&lt;\/autoPull&gt;\n                    &lt;dockerHost&gt;tcp:\/\/192.168.99.100:2376&lt;\/dockerHost&gt;\n                    &lt;certPath&gt;${user.home}\/.docker\/machine\/certs\/&lt;\/certPath&gt;\n                    &lt;images&gt;\n                        &lt;image&gt;\n                            &lt;name&gt;mongo&lt;\/name&gt;\n                            &lt;run&gt;\n                                &lt;ports&gt;\n                                    &lt;port&gt;27017:27017&lt;\/port&gt;\n                                &lt;\/ports&gt;   \n                            &lt;\/run&gt;\n                        &lt;\/image&gt;\n                       \n                    &lt;\/images&gt;\n                &lt;\/configuration&gt;\n                &lt;!-- Hooking into the lifecycle --&gt;\n                &lt;executions&gt;\n                    &lt;execution&gt;\n                        &lt;id&gt;start&lt;\/id&gt;\n                        &lt;phase&gt;pre-integration-test&lt;\/phase&gt;\n                        &lt;goals&gt;\n                            &lt;goal&gt;start&lt;\/goal&gt;\n                        &lt;\/goals&gt;\n                    &lt;\/execution&gt;\n                    &lt;execution&gt;\n                        &lt;id&gt;stop&lt;\/id&gt;\n                        &lt;phase&gt;post-integration-test&lt;\/phase&gt;\n                        &lt;goals&gt;\n                            &lt;goal&gt;stop&lt;\/goal&gt;\n                        &lt;\/goals&gt;\n                    &lt;\/execution&gt;\n                &lt;\/executions&gt;\n            &lt;\/plugin&gt;\n        &lt;\/plugins&gt;\n    &lt;\/build&gt;\n    &lt;dependencies&gt;\n       &lt;dependency&gt;\n\t      &lt;groupId&gt;org.mongodb&lt;\/groupId&gt;\n\t      &lt;artifactId&gt;mongo-java-driver&lt;\/artifactId&gt;\n\t      &lt;version&gt;3.2.2&lt;\/version&gt;\n       &lt;\/dependency&gt;\n        &lt;dependency&gt;\n            &lt;groupId&gt;junit&lt;\/groupId&gt;\n            &lt;artifactId&gt;junit&lt;\/artifactId&gt;\n            &lt;version&gt;4.12&lt;\/version&gt;\n            &lt;scope&gt;test&lt;\/scope&gt;\n        &lt;\/dependency&gt;\n    &lt;\/dependencies&gt;\n  &lt;\/project&gt;\n<\/pre>\n<h3><a name=\"junit\"><\/a>4.2 Creating integration tests<\/h3>\n<p>Integration tests are executed after creating a MongoDB container by the <code>maven-docker-plugin<\/code>. We are going to create a test to validate the following <code>Zoo<\/code> component, which only has one operation called <code>addAnimal<\/code> that inserts an animal to MongoDB.[ulp id=&#8217;6PVIvOz3kDbYmNRn&#8217;]<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Zoo.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package javacodegeeks;\n\nimport org.bson.Document;\n\nimport com.mongodb.MongoClient;\n\npublic class Zoo {\n\n\tprivate MongoClient client;\n\n\tpublic Zoo(MongoClient client) {\n\t\tthis.client = client;\n\t}\n\n\tpublic void addAnimal(String name, String type) {\n\t\tDocument doc = new Document(\"name\", \"lion\").append(\"type\", \"mammal\");\n\t\tclient.getDatabase(\"mydb\").getCollection(\"animals\").insertOne(doc);\n\t}\n}\n<\/pre>\n<p>To test the <code>Zoo<\/code> component, we just validate, with an empty database, that after invoking the <code>addAnimal<\/code> operation, MongoDB contains a new animal.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>IntegrationTest.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package javacodegeeks;\n\nimport org.bson.Document;\nimport org.junit.AfterClass;\nimport org.junit.Assert;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport com.mongodb.MongoClient;\nimport com.mongodb.client.FindIterable;\nimport com.mongodb.client.MongoDatabase;\n\npublic class IntegrationTest {\n\n\tprivate static MongoClient client;\n\n\t@BeforeClass\n\tpublic static void start() {\n\t\tclient = new MongoClient(\"192.168.99.100\");\n\t\tMongoDatabase db = client.getDatabase(\"mydb\");\n\t\tdb.createCollection(\"animals\");\n\t}\n\n\t@Test\n\tpublic void testMongoInsert() {\n\n\t\tZoo zoo = new Zoo(client);\n\t\tzoo.addAnimal(\"lion\", \"mammal\");\n\n\t\tFindIterable it = client.getDatabase(\"mydb\").getCollection(\"animals\")\n\t\t\t\t.find(new Document(\"name\", \"lion\"));\n\t\tAssert.assertNotNull(it.first());\n\n\t}\n\t\n\t@AfterClass\n\tpublic static void stop(){\n\t\tclient.close();\n\t}\n}\n<\/pre>\n<p>Notice that the IP address of our MongDB database is our Docker machine.<\/p>\n<h3><a name=\"verify\"><\/a>4.3 Running the tests<\/h3>\n<p>To run our integration tests, we simply need to execute the <code>mvn verify<\/code> command.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Run integration tests<\/em><\/span><\/p>\n<pre class=\"brush:bash\">mvn verify\n<\/pre>\n<p>Which will produce these contents:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Mvn verify output<\/em><\/span><\/p>\n<pre class=\"brush:bash\">INFO] Building jar: \/Users\/rpau\/workspace\/javacodegeeks\/target\/javacodegeeks-1.0-SNAPSHOT.jar\n[INFO] \n[INFO] --- docker-maven-plugin:0.15.0:start (start) @ javacodegeeks ---\n[INFO] DOCKER&gt; [mongo] : Start container a2a9d37cbbfd\n[INFO] \n[INFO] --- maven-failsafe-plugin:2.19.1:integration-test (integration-test) @ javacodegeeks ---\n\n-------------------------------------------------------\n T E S T S\n-------------------------------------------------------\nRunning javacodegeeks.IntegrationTest\nmay 15, 2016 6:11:10 PM com.mongodb.diagnostics.logging.JULLogger log\nINFORMACI\u00d3N: Cluster created with settings {hosts=[192.168.99.100:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}\nmay 15, 2016 6:11:10 PM com.mongodb.diagnostics.logging.JULLogger log\nINFORMACI\u00d3N: No server chosen by WritableServerSelector from cluster description ClusterDescription{type=UNKNOWN, connectionMode=SINGLE, all=[ServerDescription{address=192.168.99.100:27017, type=UNKNOWN, state=CONNECTING}]}. Waiting for 30000 ms before timing out\nmay 15, 2016 6:11:10 PM com.mongodb.diagnostics.logging.JULLogger log\nINFORMACI\u00d3N: Opened connection [connectionId{localValue:1, serverValue:1}] to 192.168.99.100:27017\nmay 15, 2016 6:11:10 PM com.mongodb.diagnostics.logging.JULLogger log\nINFORMACI\u00d3N: Monitor thread successfully connected to server with description ServerDescription{address=192.168.99.100:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 2, 6]}, minWireVersion=0, maxWireVersion=4, maxDocumentSize=16777216, roundTripTimeNanos=1473362}\nmay 15, 2016 6:11:10 PM com.mongodb.diagnostics.logging.JULLogger log\nINFORMACI\u00d3N: Opened connection [connectionId{localValue:2, serverValue:2}] to 192.168.99.100:27017\nmay 15, 2016 6:11:10 PM com.mongodb.diagnostics.logging.JULLogger log\nINFORMACI\u00d3N: Closed connection [connectionId{localValue:2, serverValue:2}] to 192.168.99.100:27017 because the pool has been closed.\nTests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.601 sec - in javacodegeeks.IntegrationTest\n\nResults :\n\nTests run: 1, Failures: 0, Errors: 0, Skipped: 0\n\n[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! The file encoding for reports output files should be provided by the POM property ${project.reporting.outputEncoding}.\n[INFO] \n[INFO] --- docker-maven-plugin:0.15.0:stop (stop) @ javacodegeeks ---\n[INFO] DOCKER&gt; [mongo] : Stop and remove container a2a9d37cbbfd\n[INFO] \n[INFO] --- maven-failsafe-plugin:2.19.1:verify (verify) @ javacodegeeks ---\n<\/pre>\n<h2><a name=\"sources\"><\/a>5.Download the source code<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here:&nbsp;<strong><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/DockerTutorialForBeginners.zip\">DockerTutorialForBeginners<\/a><br \/>\n<\/strong><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this article we are going to explain the main features of Docker. We are going to briefly explain why containers are necessary, which are the main commands to use and how to use Docker in our integration tests. The following table shows an overview of the whole article: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &hellip;<\/p>\n","protected":false},"author":79,"featured_media":31013,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1354],"tags":[189,1193],"class_list":["post-36986","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker","tag-core-java-2","tag-integration-test"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Docker Tutorial for Beginners - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this article we are going to explain the main features of Docker. We are going to briefly explain why containers are necessary, which are the main\" \/>\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\/devops\/docker\/docker-tutorial-beginners\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker Tutorial for Beginners - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this article we are going to explain the main features of Docker. We are going to briefly explain why containers are necessary, which are the main\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/\" \/>\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=\"2016-05-17T08:00:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-29T12:16:34+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=\"Raquel Pau\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@raquelpau\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Raquel Pau\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/\"},\"author\":{\"name\":\"Raquel Pau\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/24fb3af8dc3ca7c96640954e2a42ad5c\"},\"headline\":\"Docker Tutorial for Beginners\",\"datePublished\":\"2016-05-17T08:00:48+00:00\",\"dateModified\":\"2019-03-29T12:16:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/\"},\"wordCount\":1177,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\",\"keywords\":[\"core java\",\"integration-test\"],\"articleSection\":[\"Docker\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/\",\"name\":\"Docker Tutorial for Beginners - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\",\"datePublished\":\"2016-05-17T08:00:48+00:00\",\"dateModified\":\"2019-03-29T12:16:34+00:00\",\"description\":\"In this article we are going to explain the main features of Docker. We are going to briefly explain why containers are necessary, which are the main\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/#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\/devops\/docker\/docker-tutorial-beginners\/#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 Beginners\"}]},{\"@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\/24fb3af8dc3ca7c96640954e2a42ad5c\",\"name\":\"Raquel Pau\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Raquel-Fernandez-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Raquel-Fernandez-96x96.jpg\",\"caption\":\"Raquel Pau\"},\"description\":\"Raquel has graduated from Computer Engineering in the Universitat Politecnica de Catalunya. She also holds a Master degree in Computation (Software Engineering) from the same university. She has an I+D profile focused about model driven development. Additionally, she is the project leader of Walkmod, an open source project to code conventions, which is part of the result of her interest in the model driven development. Currently, Raquel works as a Software Architect in the Sparsity-Technologies.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\",\"https:\/\/x.com\/raquelpau\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/raquel-fernandez\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Docker Tutorial for Beginners - Java Code Geeks","description":"In this article we are going to explain the main features of Docker. We are going to briefly explain why containers are necessary, which are the main","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\/devops\/docker\/docker-tutorial-beginners\/","og_locale":"en_US","og_type":"article","og_title":"Docker Tutorial for Beginners - Java Code Geeks","og_description":"In this article we are going to explain the main features of Docker. We are going to briefly explain why containers are necessary, which are the main","og_url":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2016-05-17T08:00:48+00:00","article_modified_time":"2019-03-29T12:16:34+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":"Raquel Pau","twitter_card":"summary_large_image","twitter_creator":"@raquelpau","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Raquel Pau","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/"},"author":{"name":"Raquel Pau","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/24fb3af8dc3ca7c96640954e2a42ad5c"},"headline":"Docker Tutorial for Beginners","datePublished":"2016-05-17T08:00:48+00:00","dateModified":"2019-03-29T12:16:34+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/"},"wordCount":1177,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","keywords":["core java","integration-test"],"articleSection":["Docker"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/","url":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/","name":"Docker Tutorial for Beginners - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","datePublished":"2016-05-17T08:00:48+00:00","dateModified":"2019-03-29T12:16:34+00:00","description":"In this article we are going to explain the main features of Docker. We are going to briefly explain why containers are necessary, which are the main","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-tutorial-beginners\/#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\/devops\/docker\/docker-tutorial-beginners\/#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 Beginners"}]},{"@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\/24fb3af8dc3ca7c96640954e2a42ad5c","name":"Raquel Pau","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Raquel-Fernandez-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Raquel-Fernandez-96x96.jpg","caption":"Raquel Pau"},"description":"Raquel has graduated from Computer Engineering in the Universitat Politecnica de Catalunya. She also holds a Master degree in Computation (Software Engineering) from the same university. She has an I+D profile focused about model driven development. Additionally, she is the project leader of Walkmod, an open source project to code conventions, which is part of the result of her interest in the model driven development. Currently, Raquel works as a Software Architect in the Sparsity-Technologies.","sameAs":["http:\/\/www.javacodegeeks.com\/","https:\/\/x.com\/raquelpau"],"url":"https:\/\/examples.javacodegeeks.com\/author\/raquel-fernandez\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/36986","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\/79"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=36986"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/36986\/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=36986"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=36986"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=36986"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}