{"id":41640,"date":"2016-11-09T11:00:48","date_gmt":"2016-11-09T09:00:48","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=41640"},"modified":"2022-01-31T13:30:53","modified_gmt":"2022-01-31T11:30:53","slug":"docker-container-use-docker","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/","title":{"rendered":"What is a Docker container and How to use it"},"content":{"rendered":"<p>In this article, we will see what is a Docker container and how to use it.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-1-introduction\">1. Introduction<\/h2>\n<p>Containers, in general, and Docker in particular is quickly gaining in popularity.\u00a0 In this post, we will get some basics sorted out about the Docker container.\u00a0 We will learn the meaning of the term <em>Container<\/em> in general and see specifically how Docker implements them.\u00a0 We will try to execute a few basic commands to understand the bare basics of Docker itself, Docker images, and Docker containers. So, let&#8217;s start.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-2-containers-what-are-they\">2. Containers, what are they?<\/h2>\n<p>Operating system designers have always striven to provide secure operating environments to applications running on them. While applications need the harness the complete power of the underlying processing power and hardware for their work, they also need to be secured from harming other running applications. Over time, operating systems have progressed to provide features to virtualize several aspects of the underlying hardware &#8211; memory, file-systems, network interfaces, process trees, etc.<\/p>\n<p>&nbsp;<br \/>These virtualization efforts diverged primarily into 2 directions (among many of course) &#8211; <em>hardware virtualization<\/em> and <em>operating system (OS) level virtualization<\/em>. <a href=\"https:\/\/en.wikipedia.org\/wiki\/Hardware_virtualization\">Hardware virtualization<\/a> refers to the creation of virtual machines (on a host OS or even further lower) that virtualizes the underlying physical machine. Users can install complete OS into such virtual machines. <a href=\"https:\/\/en.wikipedia.org\/wiki\/Operating-system-level_virtualization\">OS level virtualization<\/a> refers to features provided in the kernel (of the host OS) that allows creation of virtual and isolated hosting environments in the user space of the host OS. These virtual hosting environments are also termed <em>Containers<\/em>.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/13-virtualization-01-01.jpg\"><img decoding=\"async\" width=\"860\" height=\"480\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/13-virtualization-01-01.jpg\" alt=\"Docker container - Hardware virtualization and OS level virtualization\" class=\"wp-image-41678\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/13-virtualization-01-01.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/13-virtualization-01-01-300x167.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/13-virtualization-01-01-768x429.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption>Hardware virtualization and OS-level virtualization<\/figcaption><\/figure>\n<\/div>\n<p>Over time there have been several such Container technologies that enabled containers to be created in the user space &#8211; <a href=\"https:\/\/en.wikipedia.org\/wiki\/Chroot\">chroot<\/a>, <a href=\"http:\/\/phk.freebsd.dk\/sagas\/jails.html\">jail<\/a>, <a href=\"http:\/\/docs.oracle.com\/cd\/E36784_01\/html\/E36848\/zones.intro-1.html#scrolltoc\">Oracle Solaris Zones<\/a>, <a href=\"https:\/\/linuxcontainers.org\/lxc\/introduction\/\">LXC<\/a>, <a href=\"https:\/\/www.docker.com\/what-docker\">Docker<\/a><\/p>\n<h2 class=\"wp-block-heading\" id=\"h-3-docker-what-is-it\">3. Docker &#8211; What is it?<\/h2>\n<p>So now, what is Docker? Simply put, Docker is a container technology that enables users to deploy their applications into containers and run them within those containers. Docker enables users to easily package their applications and all of their dependencies into read-only images called Docker images. These images can be easily distributed through a Docker hub. These images can then be downloaded and executed in Docker Containers.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/14-docke-basic-workflow.jpg\"><img decoding=\"async\" width=\"860\" height=\"625\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/14-docke-basic-workflow.jpg\" alt=\"Docker container - Basic workflow while using Docker\" class=\"wp-image-41681\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/14-docke-basic-workflow.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/14-docke-basic-workflow-300x218.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/14-docke-basic-workflow-768x558.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption>Basic workflow while using Docker<\/figcaption><\/figure>\n<\/div>\n<p>Now that we are briefly introduced to Docker, let us next discuss how we can install Docker and use it to create new containers.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-4-install-docker\">4. Install Docker<\/h2>\n<p>Docker can be installed on <a href=\"https:\/\/docs.docker.com\/engine\/installation\/linux\/\">Linux<\/a>, <a href=\"https:\/\/docs.docker.com\/engine\/installation\/mac\/\">Mac<\/a>, and <a href=\"https:\/\/docs.docker.com\/engine\/installation\/windows\/\">Windows<\/a>. Please follow the installation instructions for Docker docs to get them installed in your machine.\u00a0 Once installed you can check if it is installed properly by running a Hello world container.\u00a0 Please follow <a href=\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-hello-world-example\/\">this<\/a> post to explore a few ways to do so.\u00a0 Now that Docker is installed, let us play around with the basics.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-5-basic-commands-to-understand-your-docker-installation\">5. Basic commands to understand your Docker installation<\/h2>\n<p>We can get overall information from Docker using the command:<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">$ docker info<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/01-docker-info-01-01.jpg\"><img decoding=\"async\" width=\"860\" height=\"591\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/01-docker-info-01-01.jpg\" alt=\"Docker container - dokcer info\" class=\"wp-image-41642\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/01-docker-info-01-01.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/01-docker-info-01-01-300x206.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/01-docker-info-01-01-768x528.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption>The output of the command &#8220;docker info&#8221;<\/figcaption><\/figure>\n<\/div>\n<p>As you can see from the top 3 lines of the output, the number of total containers and images is 0 since we have a fresh install of Docker.<\/p>\n<p>Once installed you can check the Docker images present using the command<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">$ docker images<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/02-docker-images-01-01.jpg\"><img decoding=\"async\" width=\"860\" height=\"106\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/02-docker-images-01-01.jpg\" alt=\"Docker container - Output of Docker images after a fresh Docker install\" class=\"wp-image-41644\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/02-docker-images-01-01.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/02-docker-images-01-01-300x37.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/02-docker-images-01-01-768x95.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption>The output of Docker images after a fresh Docker install<\/figcaption><\/figure>\n<\/div>\n<p>It will be empty since we have installed Docker just now.<\/p>\n<p>Once installed you can check the Docker containers present using the command<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">$ docker ps<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/03-docker-ps-01-01.jpg\"><img decoding=\"async\" width=\"860\" height=\"122\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/03-docker-ps-01-01.jpg\" alt=\"Docker container - Output of docker ps for a fresh Docker install\" class=\"wp-image-41645\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/03-docker-ps-01-01.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/03-docker-ps-01-01-300x43.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/03-docker-ps-01-01-768x109.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption>The output of docker ps for a fresh Docker install<\/figcaption><\/figure>\n<\/div>\n<p>It will be empty since we have installed Docker just now.&nbsp; Now let us create a container and try to understand how Docker behaves.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-6-basic-docker-commands-to-create-containers-and-images\">6. Basic Docker commands to create containers and images<\/h2>\n<p>Let us suppose that we want to create a separate container running Alpine Linux. To do this we simply pull down the official Alpine Docker image shared in the Docker Hub.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"wp-block-preformatted brush:bash\">$ docker pull alpine:latest<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/04-docker-pull-alpine-01-01.jpg\"><img decoding=\"async\" width=\"860\" height=\"222\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/04-docker-pull-alpine-01-01.jpg\" alt=\"Docker container - Output of docker pull\" class=\"wp-image-41647\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/04-docker-pull-alpine-01-01.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/04-docker-pull-alpine-01-01-300x77.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/04-docker-pull-alpine-01-01-768x198.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption>The output of docker pull<\/figcaption><\/figure>\n<\/div>\n<p>If you do not have this Docker image already then you will see a similar output like below. Otherwise, you will get a message saying you already have this image. Let us see what Docker tells us about the number of images available locally now.<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">$ docker info<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/05-docker-info-02-02.jpg\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/05-docker-info-02-02.jpg\" alt=\"Docker container - Partial output of docker info after pulling an image\" class=\"wp-image-41648\"\/><\/a><figcaption>The partial output of docker info after pulling an image<\/figcaption><\/figure>\n<\/div>\n<p>Now you can see that the number of images is 1 &#8211; the Alpine image we just downloaded. However, the number of Containers is still 0 since we have not spawned a new container yet. This image gets stored locally in the folder <code>\/var\/lib\/docker\/image<\/code><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/06-ls-01-02.jpg\"><img decoding=\"async\" width=\"860\" height=\"149\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/06-ls-01-02.jpg\" alt=\"Docker container - Local location of downloaded Docker images in \/var\/lib\/docker\" class=\"wp-image-41653\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/06-ls-01-02.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/06-ls-01-02-300x52.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/06-ls-01-02-768x133.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption>Local location of downloaded Docker images in \/var\/lib\/docker<\/figcaption><\/figure>\n<\/div>\n<p>We can see that the SHA256 id listed is the same as in the output for <code>docker images<\/code>.<\/p>\n<p>To use this image, we need to create a new container out of this image. We do that by the <code>docker run<\/code> command.<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">$ docker run alpine:latest ls -l<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/07-docker-run-alpine-ls-01-01.jpg\"><img decoding=\"async\" width=\"860\" height=\"409\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/07-docker-run-alpine-ls-01-01.jpg\" alt=\"Docker container - Run the Alpine image using docker run\" class=\"wp-image-41654\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/07-docker-run-alpine-ls-01-01.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/07-docker-run-alpine-ls-01-01-300x143.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/07-docker-run-alpine-ls-01-01-768x365.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption>Run the Alpine image using docker run<\/figcaption><\/figure>\n<\/div>\n<p>So we spawned a new container out of the alpine image and ran the command <code>ls -l<\/code> within this container. What you see is the output of this command within the virtual environment provided by the container. By using the <code>docker info<\/code> command we can see that the number of containers has increased by 1.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/08-docker-info-03-01.jpg\"><img decoding=\"async\" width=\"860\" height=\"350\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/08-docker-info-03-01.jpg\" alt=\"Output of docker info after creating a container\" class=\"wp-image-41655\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/08-docker-info-03-01.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/08-docker-info-03-01-300x122.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/08-docker-info-03-01-768x313.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption>The output of docker info after creating a container<\/figcaption><\/figure>\n<\/div>\n<p>Specifically, we see from the above output that the number of stopped containers has increased by 1. That is because when we spawned a new container above from the Alpine image, a new container was created and then the <code>ls -l<\/code> command was run and then the container was stopped. We can see all containers that are created by the <code>docker ps<\/code> command like so<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/09-docker-ps-all-02-01.jpg\"><img decoding=\"async\" width=\"860\" height=\"106\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/09-docker-ps-all-02-01.jpg\" alt=\"Output of docker ps --all\" class=\"wp-image-41656\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/09-docker-ps-all-02-01.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/09-docker-ps-all-02-01-300x37.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/09-docker-ps-all-02-01-768x95.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption>The output of docker ps &#8211;all<\/figcaption><\/figure>\n<\/div>\n<p>From above, there is now one container created from the Alpine image and it has exited now.<\/p>\n<p>Now let us see what happens if we use the same Alpine image to run another command in a container.<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">$ docker run alpine:latest echo \"hello world\"<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/10-docker-run-alpine-echo-hello-world-01-01.jpg\"><img decoding=\"async\" width=\"535\" height=\"113\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/10-docker-run-alpine-echo-hello-world-01-01.jpg\" alt=\"Output of docker run on Alpine image\" class=\"wp-image-41658\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/10-docker-run-alpine-echo-hello-world-01-01.jpg 535w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/10-docker-run-alpine-echo-hello-world-01-01-300x63.jpg 300w\" sizes=\"(max-width: 535px) 100vw, 535px\" \/><\/a><figcaption>The output of docker run on Alpine image<\/figcaption><\/figure>\n<\/div>\n<p>&#8220;hello world&#8221; was printed as instructed. But let us see how many containers are present now<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">$ docker ps --all<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/11-docker-ps-all-02-01.jpg\"><img decoding=\"async\" width=\"860\" height=\"120\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/11-docker-ps-all-02-01.jpg\" alt=\"Output of docker ps\" class=\"wp-image-41659\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/11-docker-ps-all-02-01.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/11-docker-ps-all-02-01-300x42.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/11-docker-ps-all-02-01-768x107.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption>Output of docker ps<\/figcaption><\/figure>\n<\/div>\n<p>We can see that Docker created a new container from the same image to execute the new command. So Docker spawns a new container from an image for every operation unless we explicitly ask it to use the same container to execute different commands.<\/p>\n<p>Now let us try to understand more about the Docker image we created<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">$ docker inspect alpine:latest<\/pre>\n<pre class=\"wp-block-preformatted brush:bash\">[\n    {\n        \"Id\": \"sha256:baa5d63471ead618ff91ddfacf1e2c81bf0612bfeb1daf00eb0843a41fbfade3\",\n        \"RepoTags\": [\n            \"alpine:latest\"\n        ],\n        \"RepoDigests\": [\n            \"alpine@sha256:1354db23ff5478120c980eca1611a51c9f2b88b61f24283ee8200bf9a54f2e5c\"\n        ],\n        \"Parent\": \"\",\n        \"Comment\": \"\",\n        \"Created\": \"2016-10-18T20:31:22.321427771Z\",\n        \"Container\": \"1d811a9194c47475510bc53700001c32f2b0eb8e3aca0914c5424109c0cd2056\",\n        \"ContainerConfig\": {\n            \"Hostname\": \"1d811a9194c4\",\n            \"Domainname\": \"\",\n            \"User\": \"\",\n            \"AttachStdin\": false,\n            \"AttachStdout\": false,\n            \"AttachStderr\": false,\n            \"Tty\": false,\n            \"OpenStdin\": false,\n            \"StdinOnce\": false,\n            \"Env\": [\n                \"PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin\"\n            ],\n            \"Cmd\": [\n                \"\/bin\/sh\",\n                \"-c\",\n                \"#(nop) ADD file:7afbc23fda8b0b3872623c16af8e3490b2cee951aed14b3794389c2f946cc8c7 in \/ \"\n            ],\n            \"Image\": \"\",\n            \"Volumes\": null,\n            \"WorkingDir\": \"\",\n            \"Entrypoint\": null,\n            \"OnBuild\": null,\n            \"Labels\": null\n        },\n        \"DockerVersion\": \"1.12.1\",\n        \"Author\": \"\",\n        \"Config\": {\n            \"Hostname\": \"1d811a9194c4\",\n            \"Domainname\": \"\",\n            \"User\": \"\",\n            \"AttachStdin\": false,\n            \"AttachStdout\": false,\n            \"AttachStderr\": false,\n            \"Tty\": false,\n            \"OpenStdin\": false,\n            \"StdinOnce\": false,\n            \"Env\": [\n                \"PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin\"\n            ],\n            \"Cmd\": null,\n            \"Image\": \"\",\n            \"Volumes\": null,\n            \"WorkingDir\": \"\",\n            \"Entrypoint\": null,\n            \"OnBuild\": null,\n            \"Labels\": null\n        },\n        \"Architecture\": \"amd64\",\n        \"Os\": \"linux\",\n        \"Size\": 4799225,\n        \"VirtualSize\": 4799225,\n        \"GraphDriver\": {\n            \"Name\": \"devicemapper\",\n            \"Data\": {\n                \"DeviceId\": \"7\",\n                \"DeviceName\": \"docker-253:3-135839549-8cb0423f038b9f8d5f1b1a28bc13ba1a32ec373994d46b41b299774aa15e2b12\",\n                \"DeviceSize\": \"10737418240\"\n            }\n        },\n        \"RootFS\": {\n            \"Type\": \"layers\",\n            \"Layers\": [\n                \"sha256:011b303988d241a4ae28a6b82b0d8262751ef02910f0ae2265cb637504b72e36\"\n            ]\n        }\n    }\n]\n<\/pre>\n<p>That is a lot of information we get about the image there. We will not discuss them in detail here but you can see that the image id, tag, and time-stamp of creation are obvious there. Any containers created from this image are listed next with details of that container. The Docker version used and the Author of the image are also listed. Then follow further details of the image, its architecture of the virtual hosting environment, and finally the emulated root file-system for that image.[ulp id=&#8217;6PVIvOz3kDbYmNRn&#8217;]<\/p>\n<p>Now let us try to understand more about the container we created from this image. Let us see what all containers we have at present.<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">$ docker ps --all<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/12-docker-ps-all-03-01.jpg\"><img decoding=\"async\" width=\"860\" height=\"118\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/12-docker-ps-all-03-01.jpg\" alt=\"Output of docker ps\" class=\"wp-image-41667\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/12-docker-ps-all-03-01.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/12-docker-ps-all-03-01-300x41.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/12-docker-ps-all-03-01-768x105.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption>The output of docker ps<\/figcaption><\/figure>\n<\/div>\n<p>We see that the containers <code>adoring_bell<\/code> and <code>desperate_poincare<\/code> is based on the image alpine:latest. Let us see the metadata of this container more.<\/p>\n<pre class=\"wp-block-preformatted brush:bash\">$ docker inspect adoring_bell<\/pre>\n<pre class=\"wp-block-preformatted brush:java; wrap-lines:false\">[\n    {\n        \"Id\": \"c1631bed732bac64355c652ef0b82876b5c7c8a89c3dfe45a4155e1148d5e46b\",\n        \"Created\": \"2016-11-08T10:38:04.90010304Z\",\n        \"Path\": \"echo\",\n        \"Args\": [\n            \"hello world\"\n        ],\n        \"State\": {\n            \"Status\": \"exited\",\n            \"Running\": false,\n            \"Paused\": false,\n            \"Restarting\": false,\n            \"OOMKilled\": false,\n            \"Dead\": false,\n            \"Pid\": 0,\n            \"ExitCode\": 0,\n            \"Error\": \"\",\n            \"StartedAt\": \"2016-11-08T10:38:05.582857658Z\",\n            \"FinishedAt\": \"2016-11-08T10:38:05.610419062Z\"\n        },\n        \"Image\": \"sha256:baa5d63471ead618ff91ddfacf1e2c81bf0612bfeb1daf00eb0843a41fbfade3\",\n        \"ResolvConfPath\": \"\/home\/hariharan\/work\/docker-home\/containers\/c1631bed732bac64355c652ef0b82876b5c7c8a89c3dfe45a4155e1148d5e46b\/resolv.conf\",\n        \"HostnamePath\": \"\/home\/hariharan\/work\/docker-home\/containers\/c1631bed732bac64355c652ef0b82876b5c7c8a89c3dfe45a4155e1148d5e46b\/hostname\",\n        \"HostsPath\": \"\/home\/hariharan\/work\/docker-home\/containers\/c1631bed732bac64355c652ef0b82876b5c7c8a89c3dfe45a4155e1148d5e46b\/hosts\",\n        \"LogPath\": \"\/home\/hariharan\/work\/docker-home\/containers\/c1631bed732bac64355c652ef0b82876b5c7c8a89c3dfe45a4155e1148d5e46b\/c1631bed732bac64355c652ef0b82876b5c7c8a89c3dfe45a4155e1148d5e46b-json.log\",\n        \"Name\": \"\/adoring_bell\",\n        \"RestartCount\": 0,\n        \"Driver\": \"devicemapper\",\n        \"MountLabel\": \"\",\n        \"ProcessLabel\": \"\",\n        \"AppArmorProfile\": \"\",\n        \"ExecIDs\": null,\n        \"HostConfig\": {\n            \"Binds\": null,\n            \"ContainerIDFile\": \"\",\n            \"LogConfig\": {\n                \"Type\": \"json-file\",\n                \"Config\": {}\n            },\n            \"NetworkMode\": \"default\",\n            \"PortBindings\": {},\n            \"RestartPolicy\": {\n                \"Name\": \"no\",\n                \"MaximumRetryCount\": 0\n            },\n            \"AutoRemove\": false,\n            \"VolumeDriver\": \"\",\n            \"VolumesFrom\": null,\n            \"CapAdd\": null,\n            \"CapDrop\": null,\n            \"Dns\": [],\n            \"DnsOptions\": [],\n            \"DnsSearch\": [],\n            \"ExtraHosts\": null,\n            \"GroupAdd\": null,\n            \"IpcMode\": \"\",\n            \"Cgroup\": \"\",\n            \"Links\": null,\n            \"OomScoreAdj\": 0,\n            \"PidMode\": \"\",\n            \"Privileged\": false,\n            \"PublishAllPorts\": false,\n            \"ReadonlyRootfs\": false,\n            \"SecurityOpt\": null,\n            \"UTSMode\": \"\",\n            \"UsernsMode\": \"\",\n            \"ShmSize\": 67108864,\n            \"Runtime\": \"runc\",\n            \"ConsoleSize\": [\n                0,\n                0\n            ],\n            \"Isolation\": \"\",\n            \"CpuShares\": 0,\n            \"Memory\": 0,\n            \"CgroupParent\": \"\",\n            \"BlkioWeight\": 0,\n            \"BlkioWeightDevice\": null,\n            \"BlkioDeviceReadBps\": null,\n            \"BlkioDeviceWriteBps\": null,\n            \"BlkioDeviceReadIOps\": null,\n            \"BlkioDeviceWriteIOps\": null,\n            \"CpuPeriod\": 0,\n            \"CpuQuota\": 0,\n            \"CpusetCpus\": \"\",\n            \"CpusetMems\": \"\",\n            \"Devices\": [],\n            \"DiskQuota\": 0,\n            \"KernelMemory\": 0,\n            \"MemoryReservation\": 0,\n            \"MemorySwap\": 0,\n            \"MemorySwappiness\": -1,\n            \"OomKillDisable\": false,\n            \"PidsLimit\": 0,\n            \"Ulimits\": null,\n            \"CpuCount\": 0,\n            \"CpuPercent\": 0,\n            \"IOMaximumIOps\": 0,\n            \"IOMaximumBandwidth\": 0\n        },\n        \"GraphDriver\": {\n            \"Name\": \"devicemapper\",\n            \"Data\": {\n                \"DeviceId\": \"11\",\n                \"DeviceName\": \"docker-253:3-135839549-71e94f8b4e5e1af0b31889245ea0d2ffa54c68e6991399d0438f473846f701cc\",\n                \"DeviceSize\": \"10737418240\"\n            }\n        },\n        \"Mounts\": [],\n        \"Config\": {\n            \"Hostname\": \"c1631bed732b\",\n            \"Domainname\": \"\",\n            \"User\": \"\",\n            \"AttachStdin\": false,\n            \"AttachStdout\": true,\n            \"AttachStderr\": true,\n            \"Tty\": false,\n            \"OpenStdin\": false,\n            \"StdinOnce\": false,\n            \"Env\": [\n                \"PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin\"\n            ],\n            \"Cmd\": [\n                \"echo\",\n                \"hello world\"\n            ],\n            \"Image\": \"alpine:latest\",\n            \"Volumes\": null,\n            \"WorkingDir\": \"\",\n            \"Entrypoint\": null,\n            \"OnBuild\": null,\n            \"Labels\": {}\n        },\n        \"NetworkSettings\": {\n            \"Bridge\": \"\",\n            \"SandboxID\": \"27ee3cf100495a82743f1ec700195a4e560a04e0164a65976774ea23bb515450\",\n            \"HairpinMode\": false,\n            \"LinkLocalIPv6Address\": \"\",\n            \"LinkLocalIPv6PrefixLen\": 0,\n            \"Ports\": null,\n            \"SandboxKey\": \"\/var\/run\/docker\/netns\/27ee3cf10049\",\n            \"SecondaryIPAddresses\": null,\n            \"SecondaryIPv6Addresses\": null,\n            \"EndpointID\": \"\",\n            \"Gateway\": \"\",\n            \"GlobalIPv6Address\": \"\",\n            \"GlobalIPv6PrefixLen\": 0,\n            \"IPAddress\": \"\",\n            \"IPPrefixLen\": 0,\n            \"IPv6Gateway\": \"\",\n            \"MacAddress\": \"\",\n            \"Networks\": {\n                \"bridge\": {\n                    \"IPAMConfig\": null,\n                    \"Links\": null,\n                    \"Aliases\": null,\n                    \"NetworkID\": \"efd29ba943ae4030c14b6e88fda502ff260a490ae5d264e9626d3882d7358195\",\n                    \"EndpointID\": \"\",\n                    \"Gateway\": \"\",\n                    \"IPAddress\": \"\",\n                    \"IPPrefixLen\": 0,\n                    \"IPv6Gateway\": \"\",\n                    \"GlobalIPv6Address\": \"\",\n                    \"GlobalIPv6PrefixLen\": 0,\n                    \"MacAddress\": \"\"\n                }\n            }\n        }\n    }\n]\n<\/pre>\n<p>There is a wealth of info there. We will not get into the details but discuss it overall here. The first 5 entries give the container id, time-stamp at container creation, the command sent to the container at the start (echo &#8220;hello world&#8221;), and the current state of the container (it has exited now). Next follows the details of the image from which the container was spawned and where it is mapped into the local file system. The container name assigned is seen (adoring_bell). Then follows the various details of the emulated virtual environments &#8211; the virtual networks, virtual mount points, etc.,<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-7-summary\">7. Summary<\/h2>\n<p>We covered some very basic understanding of what a Docker container is in this post. We were introduced to the concept of OS-level virtualization and a software container. Then we covered some basic commands to download Docker images and spawn new containers from the image. Later we covered some commands to inspect the metadata that Docker holds about itself, the images, and the containers.<\/p>\n<p><strong>Last updated on Jan. 31st, 2022<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will see what is a Docker container and how to use it. 1. Introduction Containers, in general, and Docker in particular is quickly gaining in popularity.\u00a0 In this post, we will get some basics sorted out about the Docker container.\u00a0 We will learn the meaning of the term Container in general &hellip;<\/p>\n","protected":false},"author":103,"featured_media":31013,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1354],"tags":[],"class_list":["post-41640","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is a Docker container - How to use - Examples Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Learn the very basics of using Docker, how to understand the details of a Docker installation, how to create and use a Docker container.\" \/>\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-container-how-to-use-docker\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is a Docker container - How to use - Examples Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Learn the very basics of using Docker, how to understand the details of a Docker installation, how to create and use a Docker container.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/\" \/>\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-11-09T09:00:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-01-31T11:30:53+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=\"Hariharan Narayanan\" \/>\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=\"Hariharan Narayanan\" \/>\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\/docker-container-how-to-use-docker\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/\"},\"author\":{\"name\":\"Hariharan Narayanan\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/780d96edfe3bce18c5440613fa88bce3\"},\"headline\":\"What is a Docker container and How to use it\",\"datePublished\":\"2016-11-09T09:00:48+00:00\",\"dateModified\":\"2022-01-31T11:30:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/\"},\"wordCount\":1348,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\",\"articleSection\":[\"Docker\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/\",\"name\":\"What is a Docker container - How to use - Examples Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\",\"datePublished\":\"2016-11-09T09:00:48+00:00\",\"dateModified\":\"2022-01-31T11:30:53+00:00\",\"description\":\"Learn the very basics of using Docker, how to understand the details of a Docker installation, how to create and use a Docker container.\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/#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-container-how-to-use-docker\/#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\":\"What is a Docker container and How to use it\"}]},{\"@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\/780d96edfe3bce18c5440613fa88bce3\",\"name\":\"Hariharan Narayanan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Hariharan-Narayanan-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Hariharan-Narayanan-96x96.jpg\",\"caption\":\"Hariharan Narayanan\"},\"description\":\"Hari graduated from the School of Computer and Information Sciences in the University of Hyderabad. Over his career he has been involved in many complex projects in mobile applications, enterprise applications, distributed applications, micro-services, and other platforms and frameworks. He works as a consultant and is mainly involved with projects based on Java, C++ and Big Data technologies.\",\"sameAs\":[\"https:\/\/www.javacodegeeks.com\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/hariharan-narayanan\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is a Docker container - How to use - Examples Java Code Geeks","description":"Learn the very basics of using Docker, how to understand the details of a Docker installation, how to create and use a Docker container.","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-container-how-to-use-docker\/","og_locale":"en_US","og_type":"article","og_title":"What is a Docker container - How to use - Examples Java Code Geeks","og_description":"Learn the very basics of using Docker, how to understand the details of a Docker installation, how to create and use a Docker container.","og_url":"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2016-11-09T09:00:48+00:00","article_modified_time":"2022-01-31T11:30:53+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":"Hariharan Narayanan","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Hariharan Narayanan","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/"},"author":{"name":"Hariharan Narayanan","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/780d96edfe3bce18c5440613fa88bce3"},"headline":"What is a Docker container and How to use it","datePublished":"2016-11-09T09:00:48+00:00","dateModified":"2022-01-31T11:30:53+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/"},"wordCount":1348,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","articleSection":["Docker"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/","url":"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/","name":"What is a Docker container - How to use - Examples Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","datePublished":"2016-11-09T09:00:48+00:00","dateModified":"2022-01-31T11:30:53+00:00","description":"Learn the very basics of using Docker, how to understand the details of a Docker installation, how to create and use a Docker container.","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/docker-container-how-to-use-docker\/#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-container-how-to-use-docker\/#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":"What is a Docker container and How to use it"}]},{"@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\/780d96edfe3bce18c5440613fa88bce3","name":"Hariharan Narayanan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Hariharan-Narayanan-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Hariharan-Narayanan-96x96.jpg","caption":"Hariharan Narayanan"},"description":"Hari graduated from the School of Computer and Information Sciences in the University of Hyderabad. Over his career he has been involved in many complex projects in mobile applications, enterprise applications, distributed applications, micro-services, and other platforms and frameworks. He works as a consultant and is mainly involved with projects based on Java, C++ and Big Data technologies.","sameAs":["https:\/\/www.javacodegeeks.com"],"url":"https:\/\/examples.javacodegeeks.com\/author\/hariharan-narayanan\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/41640","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\/103"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=41640"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/41640\/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=41640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=41640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=41640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}