{"id":6366,"date":"2023-08-21T20:55:33","date_gmt":"2023-08-21T20:55:33","guid":{"rendered":"https:\/\/www.webhi.com\/how-to\/?p=6366"},"modified":"2023-12-07T16:06:40","modified_gmt":"2023-12-07T16:06:40","slug":"introduction-to-building-and-pushing-docker-images","status":"publish","type":"post","link":"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/","title":{"rendered":"Introduction to Building and Pushing Docker Images"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/08\/build_docker_en.jpg\" alt=\"docker build docker push dockerfile\" class=\"wp-image-6380\" srcset=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/08\/build_docker_en.jpg 1200w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/08\/build_docker_en-300x169.jpg 300w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/08\/build_docker_en-1024x576.jpg 1024w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/08\/build_docker_en-768x432.jpg 768w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/08\/build_docker_en-150x84.jpg 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p>Docker images are the building blocks of Docker containers. An image contains everything that is needed to run an application or service inside a container \u2013 the code or binaries, runtimes, dependencies, and configurations.<\/p>\n\n\n\n<p>Images are immutable, meaning they can&#8217;t be changed once built. To make changes, you build a new image. Images are also layered, meaning each image builds on top of a base image, adding just the changes needed for that specific image. This makes images lightweight, reusable, and fast to build.<\/p>\n\n\n\n<p>There are two main steps to working with Docker images:<\/p>\n\n\n\n<ol>\n<li>Building &#8211; Creates a Docker image from a Dockerfile<\/li>\n\n\n\n<li>Pushing &#8211; Uploads an image to a registry like Docker Hub<\/li>\n<\/ol>\n\n\n\n<p>This guide will cover these steps in detail, including:<\/p>\n\n\n\n<ul>\n<li>Dockerfile basics<\/li>\n\n\n\n<li>Building images locally<\/li>\n\n\n\n<li>Tagging images<\/li>\n\n\n\n<li>Pushing images to registries<\/li>\n\n\n\n<li>Managing images<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"dockerfile-basics\">Dockerfile Basics<\/h2>\n\n\n\n<p>Docker images are built from a Dockerfile &#8211; a text file that contains instructions for building the image. A Dockerfile defines everything that goes into the image &#8211; the OS, configurations, files and folders to copy, network ports to expose, Docker volumes to create, and more.<\/p>\n\n\n\n<p>Some common Dockerfile instructions include:<\/p>\n\n\n\n<ul>\n<li><code>FROM<\/code>&nbsp;&#8211; Sets the base image to build upon<\/li>\n\n\n\n<li><code>COPY<\/code>&nbsp;&#8211; Copy files from the host into the image<\/li>\n\n\n\n<li><code>RUN<\/code>&nbsp;&#8211; Run commands and shell scripts during build<\/li>\n\n\n\n<li><code>EXPOSE<\/code>&nbsp;&#8211; Expose network ports the container will listen on<\/li>\n\n\n\n<li><code>ENV<\/code>&nbsp;&#8211; Set environment variables<\/li>\n\n\n\n<li><code>ENTRYPOINT<\/code>&nbsp;&#8211; Define the executable to run when container starts<\/li>\n\n\n\n<li><code>CMD<\/code>&nbsp;&#8211; Default parameters that get passed to the ENTRYPOINT<\/li>\n<\/ul>\n\n\n\n<p>Here is a simple Dockerfile example that builds a Node.js app:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"docker\" class=\"language-docker\"><em># Use the latest Node.js 11 base image<\/em>\nFROM node:11\n\n<em># Set the working directory in the container  <\/em>\nWORKDIR \/app\n\n<em># Copy package files and install dependencies<\/em>\nCOPY package*.json .\/\nRUN npm install \n\n<em># Copy app source code<\/em>\nCOPY . .\n\n<em># Expose port and start application<\/em>\nEXPOSE 8080\nCMD [\"node\", \"app.js\"] <\/code><\/pre>\n\n\n\n<p>This uses the&nbsp;<code>node:11<\/code>&nbsp;image as a starting point, copies the app source code into the image, installs dependencies, and sets the app to start on container launch.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"building-local-images\">Building Local Images<\/h2>\n\n\n\n<p>With a Dockerfile ready, you can build an image using the&nbsp;<code>docker build<\/code>&nbsp;command. This will build the image step-by-step as per the Dockerfile instructions.<\/p>\n\n\n\n<p>The basic format is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ docker build [options] PATH<\/code><\/pre>\n\n\n\n<p>Where PATH is the location of the Dockerfile.<\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ docker build -t my-app .<\/code><\/pre>\n\n\n\n<p>This will look for a Dockerfile in the current directory and build an image called&nbsp;<code>my-app<\/code>&nbsp;from it.<\/p>\n\n\n\n<p>Some key options:<\/p>\n\n\n\n<ul>\n<li><code>-t<\/code>&nbsp;&#8211; Tag the image with a repository name and tag<\/li>\n\n\n\n<li><code>--no-cache<\/code>&nbsp;&#8211; Rebuild the image from scratch instead of using cache<\/li>\n\n\n\n<li><code>-f<\/code>&nbsp;&#8211; Path to the Dockerfile if it&#8217;s not in the current directory<\/li>\n<\/ul>\n\n\n\n<p>You can build images for different environments or parameters by simply having multiple Dockerfiles, e.g. Dockerfile.dev, Dockerfile.prod.<\/p>\n\n\n\n<p>During development, you&#8217;ll want to iterate rapidly by rebuilding images frequently as you make changes to the application. Using the cache speeds up rebuild times significantly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"tagging-images\">Tagging Images<\/h2>\n\n\n\n<p>Image tags identify an image as belonging to a repository and provide a version or variant name.<\/p>\n\n\n\n<p>Tags consist of the repository name and tag name separated by a colon, such as&nbsp;<code>my-app:latest<\/code>.<\/p>\n\n\n\n<p>When building an image, the&nbsp;<code>-t<\/code>&nbsp;flag tags it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ docker build -t my-app:latest .<\/code><\/pre>\n\n\n\n<p>This names the image&nbsp;<code>my-app<\/code>&nbsp;and tags it&nbsp;<code>latest<\/code>.<\/p>\n\n\n\n<p>If no tag is provided,&nbsp;<code>latest<\/code>&nbsp;is assumed.<\/p>\n\n\n\n<p>Some common tagging strategies:<\/p>\n\n\n\n<ul>\n<li><code>latest<\/code>&nbsp;&#8211; The most up-to-date stable version<\/li>\n\n\n\n<li>Git commit SHA &#8211; Tag build with commit SHA for traceability<\/li>\n\n\n\n<li>Semantic versions &#8211; Tags like&nbsp;<code>v1.0.2<\/code>&nbsp;for release versions<\/li>\n\n\n\n<li>Variant tags &#8211; Such as&nbsp;<code>prod<\/code>,&nbsp;<code>test<\/code>,&nbsp;<code>dev<\/code>&nbsp;to denote what the image is used for<\/li>\n<\/ul>\n\n\n\n<p><strong>Note:<\/strong>&nbsp;Tagging gives meaning and context to an image. Untagged images are difficult to manage.<\/p>\n\n\n\n<p>You can retag an existing image to add or modify tags:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ docker tag my-app:latest my-app:v1.0<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"pushing-images-to-docker-registries\">Pushing Images to Docker Registries<\/h2>\n\n\n\n<p>To share Docker images with others, you push them to a registry. A registry stores Docker images that can then be pulled down and used by any Docker host.<\/p>\n\n\n\n<p>The default registry is&nbsp;<a href=\"https:\/\/hub.docker.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Docker Hub<\/a>, which has public and private repositories.<\/p>\n\n\n\n<p>To push an image:<\/p>\n\n\n\n<ol>\n<li>Tag the image with the registry name:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ docker tag my-app:latest mydockerid\/my-app:latest<\/code><\/pre>\n\n\n\n<ol start=\"2\">\n<li>Push the tagged image:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ docker push mydockerid\/my-app:latest<\/code><\/pre>\n\n\n\n<p>This will upload the image&nbsp;<code>my-app:latest<\/code>&nbsp;to the&nbsp;<code>mydockerid<\/code>&nbsp;namespace on Docker Hub.<\/p>\n\n\n\n<p>To push to a different registry:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ docker push registry.example.com\/my-app:latest<\/code><\/pre>\n\n\n\n<p>Some companies host internal private registries to store proprietary images. These require authentication and SSL for security.<\/p>\n\n\n\n<p>In a CI\/CD pipeline, you can automate building and pushing images to registries on each code change. This enables continuously deploying applications using the latest images.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"managing-local-images\">Managing Local Images<\/h2>\n\n\n\n<p>As you build images, the Docker host will store them locally in the Docker engine. To free up disk space, you&#8217;ll need to occasionally clean up old and unused images.<\/p>\n\n\n\n<p>Some useful commands for managing images:<\/p>\n\n\n\n<ul>\n<li><code>docker images<\/code>&nbsp;&#8211; Lists all images on the host<\/li>\n\n\n\n<li><code>docker image rm<\/code>&nbsp;&#8211; Remove one or more images<\/li>\n\n\n\n<li><code>docker image prune<\/code>&nbsp;&#8211; Remove unused and dangling images<\/li>\n\n\n\n<li><code>docker rmi<\/code>&nbsp;&#8211; Remove image by ID or name<\/li>\n<\/ul>\n\n\n\n<p>Example of removing images:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\"># Remove specific image\n$ docker image rm my-app:latest \n\n# Remove all images matching name\n$ docker image rm my-app\n\n# Remove dangling images \n$ docker image prune\n\n# Remove all images \n$ docker rmi $(docker images -q)<\/code><\/pre>\n\n\n\n<p>Use these commands cautiously to avoid accidentally removing images still in use or needed.<\/p>\n\n\n\n<p>You can also set up automated policies to delete old images. For example, always keeping only the 10 most recent image tags for each repository.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>That covers the basics of building, tagging, pushing and managing Docker images!<\/p>\n\n\n\n<p>Key takeaways include:<\/p>\n\n\n\n<ul>\n<li>Dockerfiles define how images are built<\/li>\n\n\n\n<li><code>docker build<\/code>&nbsp;turns a Dockerfile into a runnable image<\/li>\n\n\n\n<li>Images should be tagged with a repository and version names<\/li>\n\n\n\n<li><code>docker push<\/code>&nbsp;uploads images to registries like Docker Hub<\/li>\n\n\n\n<li><code>docker image<\/code>&nbsp;commands manage images on a Docker host<\/li>\n<\/ul>\n\n\n\n<p>With these fundamentals, you can effectively use Docker images to package and deploy applications consistently and reliably. Automating image building and deployments will let you move towards mature DevOps practices.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker images are the building blocks of Docker containers. An image contains everything that is needed to run an application or service inside a container \u2013 the code or binaries, runtimes, dependencies, and configurations. Images are immutable, meaning they can&#8217;t be changed once built. To make changes, you build a new image. Images are also ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[69,182],"tags":[],"yoast_head":"\n<title>Introduction to Building and Pushing Docker Images - WebHi Tutorials &amp; Documentations<\/title>\n<meta name=\"description\" content=\"Learn how to build and push Docker images to a registry. This beginner&#039;s guide covers Dockerfile syntax, tagging images, pushing to Docker Hub, and using image layers for efficient builds.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introduction to Building and Pushing Docker Images - WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"og:description\" content=\"Learn how to build and push Docker images to a registry. This beginner&#039;s guide covers Dockerfile syntax, tagging images, pushing to Docker Hub, and using image layers for efficient builds.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/\" \/>\n<meta property=\"og:site_name\" content=\"WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webhi.technology\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-21T20:55:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-07T16:06:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/08\/build_docker_en.jpg\" \/>\n<meta name=\"author\" content=\"webhi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:site\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webhi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/\"},\"author\":{\"name\":\"webhi\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\"},\"headline\":\"Introduction to Building and Pushing Docker Images\",\"datePublished\":\"2023-08-21T20:55:33+00:00\",\"dateModified\":\"2023-12-07T16:06:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/\"},\"wordCount\":908,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"articleSection\":[\"Linux system administration\",\"Virtualization &amp; Cloud computing\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/\",\"name\":\"Introduction to Building and Pushing Docker Images - WebHi Tutorials &amp; Documentations\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\"},\"datePublished\":\"2023-08-21T20:55:33+00:00\",\"dateModified\":\"2023-12-07T16:06:40+00:00\",\"description\":\"Learn how to build and push Docker images to a registry. This beginner's guide covers Dockerfile syntax, tagging images, pushing to Docker Hub, and using image layers for efficient builds.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webhi.com\/how-to\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Introduction to Building and Pushing Docker Images\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"name\":\"WebHi Tutorials &amp; Documentations\",\"description\":\"System administration and knowledge base\",\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\",\"name\":\"WebHi Technology\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"width\":288,\"height\":95,\"caption\":\"WebHi Technology\"},\"image\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webhi.technology\",\"https:\/\/twitter.com\/WebHiTechnology\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\",\"name\":\"webhi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1782424353\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1782424353\",\"caption\":\"webhi\"},\"sameAs\":[\"https:\/\/www.webhi.com\/how-to\"],\"url\":\"https:\/\/www.webhi.com\/how-to\/author\/webhi\/\"}]}<\/script>\n","yoast_head_json":{"title":"Introduction to Building and Pushing Docker Images - WebHi Tutorials &amp; Documentations","description":"Learn how to build and push Docker images to a registry. This beginner's guide covers Dockerfile syntax, tagging images, pushing to Docker Hub, and using image layers for efficient builds.","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:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/","og_locale":"en_US","og_type":"article","og_title":"Introduction to Building and Pushing Docker Images - WebHi Tutorials &amp; Documentations","og_description":"Learn how to build and push Docker images to a registry. This beginner's guide covers Dockerfile syntax, tagging images, pushing to Docker Hub, and using image layers for efficient builds.","og_url":"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/","og_site_name":"WebHi Tutorials &amp; Documentations","article_publisher":"https:\/\/www.facebook.com\/webhi.technology","article_published_time":"2023-08-21T20:55:33+00:00","article_modified_time":"2023-12-07T16:06:40+00:00","og_image":[{"url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/08\/build_docker_en.jpg"}],"author":"webhi","twitter_card":"summary_large_image","twitter_creator":"@WebHiTechnology","twitter_site":"@WebHiTechnology","twitter_misc":{"Written by":"webhi","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/#article","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/"},"author":{"name":"webhi","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54"},"headline":"Introduction to Building and Pushing Docker Images","datePublished":"2023-08-21T20:55:33+00:00","dateModified":"2023-12-07T16:06:40+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/"},"wordCount":908,"commentCount":0,"publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"articleSection":["Linux system administration","Virtualization &amp; Cloud computing"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/","url":"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/","name":"Introduction to Building and Pushing Docker Images - WebHi Tutorials &amp; Documentations","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/#website"},"datePublished":"2023-08-21T20:55:33+00:00","dateModified":"2023-12-07T16:06:40+00:00","description":"Learn how to build and push Docker images to a registry. This beginner's guide covers Dockerfile syntax, tagging images, pushing to Docker Hub, and using image layers for efficient builds.","breadcrumb":{"@id":"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhi.com\/how-to\/introduction-to-building-and-pushing-docker-images\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhi.com\/how-to\/"},{"@type":"ListItem","position":2,"name":"Introduction to Building and Pushing Docker Images"}]},{"@type":"WebSite","@id":"https:\/\/www.webhi.com\/how-to\/#website","url":"https:\/\/www.webhi.com\/how-to\/","name":"WebHi Tutorials &amp; Documentations","description":"System administration and knowledge base","publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webhi.com\/how-to\/#organization","name":"WebHi Technology","url":"https:\/\/www.webhi.com\/how-to\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/","url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","contentUrl":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","width":288,"height":95,"caption":"WebHi Technology"},"image":{"@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webhi.technology","https:\/\/twitter.com\/WebHiTechnology"]},{"@type":"Person","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54","name":"webhi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/","url":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1782424353","contentUrl":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1782424353","caption":"webhi"},"sameAs":["https:\/\/www.webhi.com\/how-to"],"url":"https:\/\/www.webhi.com\/how-to\/author\/webhi\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/6366"}],"collection":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/comments?post=6366"}],"version-history":[{"count":7,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/6366\/revisions"}],"predecessor-version":[{"id":7350,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/6366\/revisions\/7350"}],"wp:attachment":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/media?parent=6366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/categories?post=6366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/tags?post=6366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}