{"id":56737,"date":"2018-05-03T11:00:38","date_gmt":"2018-05-03T08:00:38","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=56737"},"modified":"2019-03-29T14:07:33","modified_gmt":"2019-03-29T12:07:33","slug":"docker-test-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/","title":{"rendered":"Docker Test Example"},"content":{"rendered":"<h2>1. Introduction<\/h2>\n<p>Continuous integration and continuous deployment has become one of the most common use cases of Docker early adopters. CI\/CD merges development with testing, allowing developers to build code collaboratively, submit the master branch, and check for issues.<\/p>\n<p>This allows developers to not only build their code, but also test their code in any environment type and as often as possible to catch bugs early in the applications development life cycle. Since Docker can integrate with tools like Jenkins and GitHub, developers can submit code in Git Hub, test the code and automatically trigger a build using Jenkins. Once the image is completed, images can be added to Docker registries.<\/p>\n<p>&nbsp;<br \/>\nThis streamlines the process, saves time on build and set up processes, all while allowing developers to run tests in parallel and automate them so that they can continue to work on other projects while tests are being run. Since Docker works on prem, in the cloud or virtual environment and supports both Linux and Windows, enterprises no longer have to deal with inconsistencies between different environments types. Perhaps one of the most widely known benefits of the Docker CaaS platform.<\/p>\n<p>In this post, firstly we will create a simple flask application. We will create an image for our application. Image will use redis for storage and it will be used as a dependency application. Python application will be a simple application. It will simple print &#8220;Welcome to Docker&#8221; on page.<\/p>\n<p>We will be using two containers one for redis and one python application. Next we will create a script to test our python application. An image will be created to run this test script in a container.<\/p>\n<h2>2. Docker<\/h2>\n<p>So to understand about CI you should be familiar with Docker and Docker compose. Let&#8217;s have an overview of what is Docker and Docker compose.<\/p>\n<p>According to the official documentation of Docker, Docker is a platform for developers and sysadmins to develop, deploy, and run applications with containers. The use of Linux containers to deploy applications is called containerization. Containers are not new, but their use for easily deploying applications is.<\/p>\n<h3>2.1 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<h3>2.2 Docker image<\/h3>\n<p>An image 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 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<h2>3. Install Docker<\/h2>\n<p>So this was the overview of Docker. Let\u2019s install Docker now. Docker Community Edition (CE) is ideal for developers. Small teams are looking to get started with Docker and experiment with container-based apps. So if you are not sure you should install CE.<\/p>\n<h3>3.1 Installing Docker on Ubuntu using the repository<\/h3>\n<p>1. Update the <code>apt<\/code> package index.<\/p>\n<pre class=\"brush:bash\">sudo apt-get update<\/pre>\n<p>2. Install packages to allow <code>apt<\/code> to use a repository over HTTPS:<\/p>\n<pre class=\"brush:bash\">sudo apt-get install \\\n    apt-transport-https \\\n    ca-certificates \\\n    curl \\\n    software-properties-common<\/pre>\n<p>3. Add Docker\u2019s official GPG key:<\/p>\n<pre class=\"brush:bash\">curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo apt-key add -<\/pre>\n<h3>3.2 Use the following command to set up the stable repository<\/h3>\n<p>1. Update the <code>apt<\/code> package index.<\/p>\n<pre class=\"brush:bash\">sudo apt-get update<\/pre>\n<p>2. 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.<\/p>\n<pre class=\"brush:bash\">sudo apt-get install docker-ce<\/pre>\n<p>3. Verify that Docker CE is installed correctly by running the hello-world image.<\/p>\n<pre class=\"brush:bash\">sudo docker run hello-world<\/pre>\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>4. 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<p>1. Define your app\u2019s environment with a <code>Dockerfile<\/code> so it can be reproduced anywhere.<br \/>\n2. Define the services that make up your app in <code>docker-compose.yml<\/code> so they can be run together in an isolated environment.<br \/>\n3. Run <code>docker-compose up<\/code> and Compose starts and runs your entire app.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2>4.1 Installing Docker-compose<\/h2>\n<p>On Linux, you can download the Docker Compose binary from the <a href=\"https:\/\/github.com\/docker\/compose\/releases\">Compose repository release page on GitHub<\/a>. Follow the instructions from the link, which involve running the <code>curl<\/code> command in your terminal to download the binaries. These step by step instructions are also included below.<\/p>\n<p>1. Run this command to download the latest version of Docker Compose:<\/p>\n<pre class=\"brush:bash\">sudo curl -L https:\/\/github.com\/docker\/compose\/releases\/download\/1.20.1\/docker-compose-`uname -s`-`uname -m` -o \/usr\/local\/bin\/Docker-compose<\/pre>\n<p>2. Apply executable permissions to the binary:<\/p>\n<pre class=\"brush:bash\">sudo chmod +x \/usr\/local\/bin\/docker-compose<\/pre>\n<p>3. Optionally, install <a href=\"https:\/\/docs.docker.com\/compose\/completion\/\">command completion<\/a> for the <code>bash<\/code> and <code>zsh<\/code> shell.<\/p>\n<p>4. Test the installation.<\/p>\n<pre class=\"brush:bash\">$ docker-compose --version\ndocker-compose version 1.20.1, build 1719ceb\n<\/pre>\n<h2>5. Creating Sample Python Application<\/h2>\n<p>In this section we will be creating a simple python application using <code>flask<\/code> and <code>redis<\/code>. Then we will Dockerize this application using <code>docker-compose<\/code>. I am just creating very simple application which will just print &#8220;Welcome to Docker&#8221;. So that you can focus on the process rather than the application logic.<\/p>\n<p>Create a folder Dockerci for our project.<\/p>\n<pre class=\"brush:bash\">$ mkdir dockerci\n$ cd dockerci\n<\/pre>\n<p>Now let&#8217;s create our python application and create a file app.py:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Python application file app.py<\/em><\/span><\/p>\n<pre class=\"brush:plain\">from flask import Flask\nfrom redis import Redis\n\napp = Flask(__name__)\nredis = Redis(host=\"redis\")\n\n@app.route(\"\/\")\ndef hello():\n    visits = redis.incr('counter')\n    html = \"<\/pre>\n<pre class=\"brush:plain\">Welcome to Docker !\n\" return html.format() if __name__ == \"__main__\": app.run(host=\"0.0.0.0\", port=80)\n<\/pre>\n<p>So this is a python application using <code>Flask<\/code> and <code>redis<\/code>. Application just returning &#8220;Welcome to Docker&#8221; text in HTML.<br \/>\nAs I have mentioned our application is using Redis and Flask. So we have to define these dependencies in our application before using them.<\/p>\n<p>Let&#8217;s create a file <code>requirements.txt<\/code> and add the content below in this file.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>requirements.txt<\/em><\/span><\/p>\n<pre class=\"brush:plain\">Flask\nRedis\n<\/pre>\n<h3>5.1 Dockerizing Python Application<\/h3>\n<p>As I have explained in Docker image, to Dockerize an application we have to create an image for application. We will use that image to run inside our container.<br \/>\nLet&#8217;s create an image for our python application.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Dockerfile<\/em><\/span><\/p>\n<pre class=\"brush:plain\">FROM python:2.7\n\nWORKDIR \/app\n\nADD requirements.txt \/app\/requirements.txt\nRUN pip install -r requirements.txt\n\nADD app.py \/app\/app.py\n\nEXPOSE 80\n\nCMD [\"python\", \"app.py\"]\n<\/pre>\n<p>Let me explain you the meaning of each line in this <code>Dockerfile<\/code>.<\/p>\n<ol>\n<li> <code>FROM python:2.7 <\/code> here we are using python(2.7) as our base image because we are creating a python application. The number after colon is the version of python we want to use for our app.<\/li>\n<li> <code>WORKDIR \/app<\/code> we are setting our work directory to <code>\/app<\/code>. Our code will reside at this location inside container.<\/li>\n<li> <code>ADD requirements.txt \/app\/requirements.txt <\/code> as our application will be using Flask and Redis dependencies. And we have defined these dependencies in <code>requirements.txt<\/code>, so adding this file too inside our work directory.<\/li>\n<li> <code>RUN pip install -r requirements.txt<\/code> installing application&#8217;s <code>pip<\/code> dependencies.<\/li>\n<li> <code>ADD app.py \/app\/app.py<\/code> adding application code to the image.<\/li>\n<li> <code>EXPOSE 80<\/code> our application will be listening on port 80.<\/li>\n<li> <code>CMD [\"python\", \"app.py\"]<\/code> this is the command that will be used to start our application.<\/li>\n<\/ol>\n<p>So in this <code>Dockerfile<\/code> we have mentioned all the resources that will be required by our application.<\/p>\n<h3>5.2 Using Docker-Compose<\/h3>\n<p>Now we have to create <code>docker-compose.yml<\/code> file so that we can use the image created by <code>Dockerile<\/code>.<\/p>\n<pre class=\"brush:bash\"> vi docker-compose.yml<\/pre>\n<p>Now add following content to this file.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>docker-compose.yml<\/em><\/span><\/p>\n<pre class=\"brush:bash\">web:\n  build: .\n  Dockerfile: Dockerfile\n  links:\n    - redis\n  ports:\n    - \"80:80\"\nredis:\n  image: redis\n<\/pre>\n<p>So <code>docker-compose.yml<\/code> file says that it will be using two containers, as it has created two services <code>web<\/code> for our application and <code>redis<\/code> as our data store. <code>web<\/code> will be using the current folder to build the image and using <code>Dockerfile<\/code> we have created above, we will create an image for our application. It defines a link to the <code>redis<\/code> service which will use the standard redis image from <code>Docker Hub<\/code>.[ulp id=&#8217;6PVIvOz3kDbYmNRn&#8217;]<\/p>\n<h3>5.3 Deploying and Running Python Application<\/h3>\n<p>We are ready with <code>Dockerfile<\/code> and <code>docker-compose.yml<\/code>. Let&#8217;s put our code into a container and run that container.<br \/>\nFor this use the below commands:<\/p>\n<pre class=\"brush:bash\">     $ Docker-compose -f ~\/javacodegeeks\/dockerci\/docker-compose.yml build\n     $ Docker-compose -f ~\/javacodegeeks\/dockerci\/docker-compose.yml up -d\n<\/pre>\n<p>The first command will set up all the components needed by our application and the second will up our container. Let&#8217;s see how many containers are running currently. As I explained above there should be two containers, one for our python application and one for <code>redis<\/code>.<br \/>\nExecute this command to check the running containers:<\/p>\n<pre class=\"brush:bash\">sudo docker ps\n<\/pre>\n<p>This should result in the below output:<\/p>\n<pre class=\"brush:bash\">CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                NAMES\n2316c8d35133        helloworld_web      \"python app.py\"          About an hour ago   Up About an hour    0.0.0.0:80-&gt;80\/tcp   helloworld_web_1\n21c3a097b00f        redis               \"Docker-entrypoint...\"   2 days ago          Up About an hour    6379\/tcp             helloworld_redis_1\n<\/pre>\n<p>So as I can see both of the containers are up and running. And we are good to go.<\/p>\n<p>Now let&#8217;s check if our application is running or not. We will make a curl request on localhost and port 80, as this is the port we have exposed to connect to our application. Execute this command below:<\/p>\n<pre class=\"brush:bash\">curl localhost:80<\/pre>\n<p>And this will give us the below output:<\/p>\n<pre class=\"brush:bash\">Welcome to Docker !<\/pre>\n<p>So our application is up and running in a Docker container. Next, we will be Dockerzing our testing environment by creating a testing script. This script will be checking in our application if it gives us the expected response or not.<\/p>\n<h2>6. Creating the Testing Environment<\/h2>\n<p>So we will create a testing environment to test our python application. It will be a simple test script which will make a <code>curl<\/code> request to our running application and check if it&#8217;s returning &#8220;Welcome Docker&#8221; text in response.<\/p>\n<h3>6.1 Creating Test Script<\/h3>\n<p>Create a simple script testing.sh.<\/p>\n<pre class=\"brush:bash\">vi testing.sh<\/pre>\n<p>And add following content to this file.<\/p>\n<pre class=\"brush:bash\">sleep 5\nif curl web | grep -q '<\/pre>\n<pre class=\"brush:plain\">Welcome to Docker !\n'; then echo \"Success!\" exit 0 else echo \"Failed!\" exit 1 fi\n<\/pre>\n<p>So this is a simple testing script just looking for &#8220;Welcome to Docker !&#8221; in the application response and it prints <code>Success<\/code> and <code>Failed<\/code> accordingly.<\/p>\n<h3>6.2 Creating Environment for testing<\/h3>\n<p>So to test our application, we will be creating a testing environment similar to the application environment.<br \/>\nLet&#8217;s Dockerize the testing script we have created and create a <code>Dockerfile.test<\/code> file.<\/p>\n<pre class=\"brush:bash\">vi Dockerfile.test<\/pre>\n<p>And add the following content to this file.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Dockerfile.test<\/em><\/span><\/p>\n<pre class=\"brush:plain\">FROM ubuntu:trusty\n\nRUN apt-get update &amp;&amp; apt-get install -yq curl &amp;&amp; apt-get clean\n\nWORKDIR \/app\n\nADD test.sh \/app\/testing.sh\n\nCMD [\"bash\", \"testing.sh\"]\n<\/pre>\n<p>So here we simply put our <code>testing.sh<\/code> into the image. In the last line is the command that will be used to run our application.<br \/>\nAlso this image is using <code>ubuntu:trusty<\/code> as base image and this will be used to install all the curl dependencies.<\/p>\n<p>Next we will connect our testing environment to our python application. We will be using <code>docker-compose<\/code> for this. Let&#8217;s create a file <code>docker-compose.test.yml<\/code>.<\/p>\n<pre class=\"brush:bash\">vi docker-compose.test<\/pre>\n<p>And add following content to this file.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>docker-compose.test.yml<\/em><\/span><\/p>\n<pre class=\"brush:plain\">sut:\n  build: .\n  Dockerfile: Dockerfile.test\n  links:\n    - web\nweb:\n  build: .\n  Dockerfile: Dockerfile\n  links:\n    - redis\nredis:\n  image: redis\n<\/pre>\n<p>So this file define a <code>sut<\/code> container and this container will be responsible for running our integration tests. <code>sut<\/code> container is using current directory as build context and specifies the <code>Dockerfile.test<\/code>. Its linking to the <code>web<\/code> and <code>redis<\/code> services.<\/p>\n<h3>6.3 Testing Application<\/h3>\n<p>So we are ready with our application running and our testing environment to test this application is also ready.<br \/>\nLet&#8217;s execute the below command and see if our script is able to test that application.<\/p>\n<pre class=\"brush:bash\">Docker-compose -f ~\/javacodegeeks\/dockerci\/docker-compose.test.yml -p ci build\n<\/pre>\n<p>So we are ready with the build and now let&#8217;s up our container.<\/p>\n<pre class=\"brush:bash\">docker-compose -f ~\/javacodegeeks\/dockerci\/docker-compose.test.yml -p ci up -d<\/pre>\n<p>Now lets check the output of our container:<\/p>\n<pre class=\"brush:bash\">docker logs -f ci_sut_1\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n100    28  100    28    0     0   1402      0 --:--:-- --:--:-- --:--:--  1473\nSuccess!\n\n<\/pre>\n<h2>7. Conclusion<\/h2>\n<p>So by using Docker and docker-compose we can Dockerize our application and we can build a testing image, to test our running application.<\/p>\n<p>We can use integration testing using <code>docker-compose.test.yml<\/code> file. So Continuous integration is one of the most popular use cases for Docker. Teams looking to build and deploy their applications quickly use Docker, combined with ecosystem tools like Jenkins, to drive apps from dev, testing staging and into production without having to tweak any code. Docker and its APIs generate automated Docker image builds and make pushes to Docker registries simple, fast and automated.<\/p>\n<h2>8. Download the Source Code<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <strong><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/DockerTest.zip\">Docker Test Example<\/a><\/strong><\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction Continuous integration and continuous deployment has become one of the most common use cases of Docker early adopters. CI\/CD merges development with testing, allowing developers to build code collaboratively, submit the master branch, and check for issues. This allows developers to not only build their code, but also test their code in any &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":[1276,1333,1319,1716,1723],"class_list":["post-56737","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker","tag-docker","tag-docker-build","tag-docker-compose","tag-python","tag-testing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Docker Test Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"1. Introduction Continuous integration and continuous deployment has become one of the most common use cases of Docker early adopters. CI\/CD merges\" \/>\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-test-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker Test Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"1. Introduction Continuous integration and continuous deployment has become one of the most common use cases of Docker early adopters. CI\/CD merges\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/\" \/>\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-05-03T08:00:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-29T12:07:33+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=\"11 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-test-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/\"},\"author\":{\"name\":\"Vikas Kumar\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/706d8eb6a246081f97db112e8df93fd9\"},\"headline\":\"Docker Test Example\",\"datePublished\":\"2018-05-03T08:00:38+00:00\",\"dateModified\":\"2019-03-29T12:07:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/\"},\"wordCount\":1801,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\",\"keywords\":[\"docker\",\"docker build\",\"docker-compose\",\"python\",\"testing\"],\"articleSection\":[\"Docker\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/\",\"name\":\"Docker Test Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\",\"datePublished\":\"2018-05-03T08:00:38+00:00\",\"dateModified\":\"2019-03-29T12:07:33+00:00\",\"description\":\"1. Introduction Continuous integration and continuous deployment has become one of the most common use cases of Docker early adopters. CI\/CD merges\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/#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-test-example\/#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 Test Example\"}]},{\"@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 Test Example - Java Code Geeks","description":"1. Introduction Continuous integration and continuous deployment has become one of the most common use cases of Docker early adopters. CI\/CD merges","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-test-example\/","og_locale":"en_US","og_type":"article","og_title":"Docker Test Example - Java Code Geeks","og_description":"1. Introduction Continuous integration and continuous deployment has become one of the most common use cases of Docker early adopters. CI\/CD merges","og_url":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2018-05-03T08:00:38+00:00","article_modified_time":"2019-03-29T12:07:33+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":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/"},"author":{"name":"Vikas Kumar","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/706d8eb6a246081f97db112e8df93fd9"},"headline":"Docker Test Example","datePublished":"2018-05-03T08:00:38+00:00","dateModified":"2019-03-29T12:07:33+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/"},"wordCount":1801,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","keywords":["docker","docker build","docker-compose","python","testing"],"articleSection":["Docker"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/","url":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/","name":"Docker Test Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","datePublished":"2018-05-03T08:00:38+00:00","dateModified":"2019-03-29T12:07:33+00:00","description":"1. Introduction Continuous integration and continuous deployment has become one of the most common use cases of Docker early adopters. CI\/CD merges","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-test-example\/#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-test-example\/#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 Test Example"}]},{"@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\/56737","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=56737"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/56737\/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=56737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=56737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=56737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}