

{"id":37999,"date":"2018-12-03T11:13:47","date_gmt":"2018-12-03T05:43:47","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=37999"},"modified":"2018-12-03T11:13:47","modified_gmt":"2018-12-03T05:43:47","slug":"docker-image-vs-container","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/","title":{"rendered":"Docker Image vs Container &#8211; Point Out The Differences"},"content":{"rendered":"<p>Today, we will see Docker Image vs Container. Moreover, while learning the difference of Docker Image and Container we will also see <strong>what is Docker<\/strong> Image and Docker Container.<\/p>\n<p>So, let&#8217;s start Docker Image vs Container Tutorial.<\/p>\n<h2><span style=\"font-weight: 400\">Difference Between Docker Image and Container<\/span><\/h2>\n<h3><span style=\"font-weight: 400\">i. What is Docker Image?<\/span><\/h3>\n<p><span style=\"font-weight: 400\">An inert, immutable, file that&#8217;s essentially a snapshot of a container is <strong>what we call a Docker image<\/strong>. Basically, Images are created with created from a Dockerfile with the docker build command. And further, they&#8217;ll produce a container when started with a run. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Moreover, in a Docker registry Images are stored like <\/span><b>registry.hub.docker.com.<\/b><span style=\"font-weight: 400\"> Since they can become quite large, images are designed to compose of layers of other images, allowing a minimal amount of data to be sent while transferring images over the network.<\/span><\/p>\n<p><strong>Some Key points:<\/strong><\/p>\n<ul>\n<li><span style=\"font-weight: 400\">In simple words, a collection of files + some metadata is what we call Image and these files form the root filesystem of a container.<\/span><\/li>\n<li><span style=\"font-weight: 400\">These images are made of layers, conceptually stacked on top of each other.<\/span><\/li>\n<li><span style=\"font-weight: 400\">And, each layer can add, change, as well as remove files.<\/span><\/li>\n<li><span style=\"font-weight: 400\">Moreover, images can share layers to optimize disk usage, transfer times, as well as memory usage. <\/span><\/li>\n<li><span style=\"font-weight: 400\">It is a read-only template which we use to create containers.<\/span><\/li>\n<li><span style=\"font-weight: 400\">Though, it can be built by you or other Docker users.<\/span><\/li>\n<li><span style=\"font-weight: 400\">Images Store in the <strong>Docker Hub<\/strong> or the local Registry.<\/span><\/li>\n<li><span style=\"font-weight: 400\">The first 12 characters are the IMAGE ID that is also a true identifier for an image. <\/span><\/li>\n<li><span style=\"font-weight: 400\">We can remove unused Docker images to clean up a Docker host. <\/span><\/li>\n<\/ul>\n<h3><span style=\"font-weight: 400\">ii. What is a Docker Container?<\/span><\/h3>\n<p><span style=\"font-weight: 400\">Generally, a runnable instance of an image is a <strong>Docker Container<\/strong>. By using the Docker API or CLI we can create, start, stop, move, or delete a container. <\/span><\/p>\n<p><span style=\"font-weight: 400\">As an advantage, we can connect a container to one or more networks or we can attach storage to it, or also we can create a new image on the basis of its current state. Moreover, it consists of; a Docker image, an execution environment, a standard set of instructions.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Well, we can also understand in some other way, that is if an image is a class, then a container is an instance of a class, that is a runtime object. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Also, we can say Containers are somehow the reason that why you&#8217;re using Docker because they&#8217;re lightweight and portable encapsulations of an environment to run applications.<\/span><\/p>\n<p><strong>Some Key points:<\/strong><\/p>\n<p><span style=\"font-weight: 400\">By using the docker run command we can create the Containers from images and also it can list with the docker ps command.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Docker engine takes an image, adds the top writable layer and initializes various settings in order to create a container (network ports, container name, ID and resource limits).<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400\">It is an Isolated application platform.<\/span><\/li>\n<li><span style=\"font-weight: 400\">They attain everything which we need to run our application.<\/span><\/li>\n<li><span style=\"font-weight: 400\">Somehow, based on images.<\/span><\/li>\n<li><span style=\"font-weight: 400\">The true identifier for the container is CONTAINER ID. <\/span><\/li>\n<li><span style=\"font-weight: 400\">Running containers can be view by docker ps and stopped containers can be view by docker ps -a.<\/span><\/li>\n<li><span style=\"font-weight: 400\">We can use NAMES to identify a started container via the &#8211;name flag.<\/span><\/li>\n<li><span style=\"font-weight: 400\">As same as Images, \u00a0by removing unused Docker containers, we can clean up a Docker host.<\/span><\/li>\n<\/ul>\n<h2><span style=\"font-weight: 400\">Docker Image vs Container<\/span><\/h2>\n<p><span style=\"font-weight: 400\">1. An image is a read-only filesystem But a container an encapsulate set of processes which are running in a read-write copy of that filesystem.<\/span><\/p>\n<p><span style=\"font-weight: 400\">2. Instead of regular copy copy-on-write use to optimize container boot time.<\/span><\/p>\n<p><span style=\"font-weight: 400\">3. From a given image, Docker run starts a container.<\/span><\/p>\n<p><span style=\"font-weight: 400\">4. The top writable layer is the major difference between a container and an image. Basically, all writes that add new or modify existing data to the container stores in this writable layer. And, while the container erases, that writable layer is also erased. But, that underlying image remains unchanged.<\/span><\/p>\n<p>So, this was all in Docker Image vs Container. Hope you like our explanation.<\/p>\n<h2><span style=\"font-weight: 400\">Conclusion<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Hence, in this Docker Image vs Container Tutorial, we have seen whole about Containers and Images in detail. Though, if any doubt occurs feel free to ask in the comment tab.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today, we will see Docker Image vs Container. Moreover, while learning the difference of Docker Image and Container we will also see what is Docker Image and Docker Container. So, let&#8217;s start Docker Image&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":38036,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16988],"tags":[17123,17122,17121,17119,17120,15705],"class_list":["post-37999","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker","tag-difference-between-docker-image-and-container","tag-docker-container-feature","tag-docker-image-features","tag-docker-image-vs-container","tag-what-is-container","tag-what-is-docker"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Docker Image vs Container - Point Out The Differences - DataFlair<\/title>\n<meta name=\"description\" content=\"Docker Image vs Container,what is Docker image,what is Docker container,Difference between Docker Image and Container,docker run image and create 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:\/\/data-flair.training\/blogs\/docker-image-vs-container\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker Image vs Container - Point Out The Differences - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Docker Image vs Container,what is Docker image,what is Docker container,Difference between Docker Image and Container,docker run image and create container\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-12-03T05:43:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/10\/Docker-Image-vs-Container-01.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Docker Image vs Container - Point Out The Differences - DataFlair","description":"Docker Image vs Container,what is Docker image,what is Docker container,Difference between Docker Image and Container,docker run image and create 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:\/\/data-flair.training\/blogs\/docker-image-vs-container\/","og_locale":"en_US","og_type":"article","og_title":"Docker Image vs Container - Point Out The Differences - DataFlair","og_description":"Docker Image vs Container,what is Docker image,what is Docker container,Difference between Docker Image and Container,docker run image and create container","og_url":"https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-12-03T05:43:47+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/10\/Docker-Image-vs-Container-01.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"Docker Image vs Container &#8211; Point Out The Differences","datePublished":"2018-12-03T05:43:47+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/"},"wordCount":690,"commentCount":1,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/10\/Docker-Image-vs-Container-01.jpg","keywords":["Difference between Docker Image and Container","Docker Container Feature","Docker Image features","Docker Image vs Container","What is Container","what is Docker"],"articleSection":["Docker Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/","url":"https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/","name":"Docker Image vs Container - Point Out The Differences - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/10\/Docker-Image-vs-Container-01.jpg","datePublished":"2018-12-03T05:43:47+00:00","description":"Docker Image vs Container,what is Docker image,what is Docker container,Difference between Docker Image and Container,docker run image and create container","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/10\/Docker-Image-vs-Container-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/10\/Docker-Image-vs-Container-01.jpg","width":1200,"height":628,"caption":"Docker Image vs Container - Point Out The Differences"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/docker-image-vs-container\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Docker Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/docker\/"},{"@type":"ListItem","position":3,"name":"Docker Image vs Container &#8211; Point Out The Differences"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/37999","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=37999"}],"version-history":[{"count":0,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/37999\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/38036"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=37999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=37999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=37999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}