{"id":17174,"date":"2023-08-03T19:56:16","date_gmt":"2023-08-03T19:56:16","guid":{"rendered":"http:\/\/64cbff25bc5584001b1212b2"},"modified":"2025-01-07T04:35:03","modified_gmt":"2025-01-07T03:35:03","slug":"quickly-dockerizing-nodejs","status":"publish","type":"post","link":"https:\/\/dassiorleando.com\/fr\/quickly-dockerizing-nodejs\/","title":{"rendered":"Docker Init: Quickly Dockerizing NodeJS Application"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"introduction\">Introduction<\/h2>\n\n\n\n<p>Containerization has revolutionized the world of software development and deployment. Docker, one of the leading containerization platforms, offers developers the ability to package their applications and dependencies into lightweight containers, ensuring consistent performance across various environments. With Docker, the process of creating Dockerfiles and Docker Compose files can be simplified using the <code>docker init<\/code> command. In this article, we will explore how <code>docker init<\/code> can speed up the containerization of a <strong>NodeJS\/NestJS<\/strong> App.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>The <strong>YouTube Channels<\/strong> in both English (En) and French (Fr) are now accessible, feel free to subscribe by clicking <a href=\"https:\/\/www.youtube.com\/@numericaideas\/channels?sub_confirmation=1\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n<\/blockquote>\n\n\n<div class=\"vlp-link-container vlp-layout-basic wp-block-visual-link-preview-link\"><a href=\"https:\/\/www.youtube.com\/@numericaideas\/channels?sub_confirmation=1\" class=\"vlp-link\" title=\"Numerica Ideas\" rel=\"nofollow\" target=\"_blank\"><\/a><div class=\"vlp-layout-zone-side\"><div class=\"vlp-block-2 vlp-link-image\"><img decoding=\"async\" src=\"https:\/\/yt3.googleusercontent.com\/klwPa3fnccvxnvUjmfGmcdJDeX8J7BMbRraxiH69WeLx6qr3fQdxYSGN37vKE4jBCqGX5pZCgQ=s900-c-k-c0x00ffffff-no-rj\" style=\"max-width: 150px; max-height: 150px\" \/><\/div><\/div><div class=\"vlp-layout-zone-main\"><div class=\"vlp-block-0 vlp-link-title\">Numerica Ideas<\/div><div class=\"vlp-block-1 vlp-link-summary\">NumericaIdeas is a technical community that creates opportunities for IT professionals, where you\u2019ll secure your dream job, and indeed the group through which you can develop your hard and soft skills at your own pace. Our motto is \u201cDiscover, Learn, Build, &amp; Share\u201d \ud83d\ude80 \ud83d\udca1 La cha\u00eene est aussi disponi\u2026<\/div><\/div><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-docker-init-\">What is &#8216;docker init&#8217;?<\/h2>\n\n\n\n<p>The <code>docker init<\/code> command is a powerful tool that enables developers to generate Dockerfiles and Docker Compose files effortlessly. By analyzing your application&#8217;s source code and dependencies, Docker can create a basic configuration, allowing you to jump-start your containerization journey.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"benefits-of-docker-init-\">Benefits of &#8216;docker init&#8217;<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Time-saving:<\/strong> Writing Dockerfiles and Docker Compose files from scratch can be time-consuming, especially for large projects. With <code>docker init<\/code>, you can significantly reduce the time and effort required to set up a basic container configuration.<\/li>\n\n\n\n<li><strong>Ease of use:<\/strong> Whether you are a Docker novice or a seasoned pro, <code>docker init<\/code> is designed to be user-friendly. It automates the initial setup, abstracting complex configurations and allowing developers to focus on building and deploying their applications.<\/li>\n\n\n\n<li><strong>Standardization:<\/strong> By utilizing <code>docker init<\/code>, you can ensure consistency in your containerization process. Standardized Dockerfiles and Docker Compose files promote better collaboration among team members and facilitate smoother integration into continuous integration and continuous deployment (CI\/CD) pipelines.<\/li>\n\n\n\n<li><strong>Flexibility:<\/strong> Although <code>docker init<\/code> creates an initial configuration, it doesn&#8217;t lock you into a rigid structure. After generation, you can modify the files as needed to tailor them to your specific application requirements.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-use-docker-init-\">How to use &#8216;docker init&#8217;?<\/h2>\n\n\n\n<p>Using <code>docker init<\/code> is straightforward, here are the steps to apply:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Install Docker:<\/strong> Ensure you have Docker installed on your system. If not, head to the Docker website and follow the installation instructions for your platform.<\/li>\n\n\n\n<li><strong>Navigate to your project directory:<\/strong> Open a terminal or command prompt and navigate to the root directory of your project, where your application source code is located.<\/li>\n\n\n\n<li><strong>Execute &#8216;docker init&#8217;:<\/strong> Type the <code>docker init<\/code> command in the terminal and hit Enter. Docker will now analyze your project&#8217;s codebase and dependencies.<\/li>\n\n\n\n<li><strong>Answer a few questions:<\/strong> Once the analysis is complete, depending on the project, a few questions will be asked so that Docker will create the Dockerfiles and Docker Compose files in your project directory.<\/li>\n\n\n\n<li><strong>Review the generated files:<\/strong> Review these files to ensure they align with your application&#8217;s requirements.<\/li>\n\n\n\n<li><strong>Make necessary adjustments:<\/strong> If needed, modify the generated files to add specific configurations or tweak settings as per your project&#8217;s needs. Docker&#8217;s initial setup serves as a solid starting point, but customization is often necessary for complex applications.<\/li>\n\n\n\n<li><strong>Build and deploy:<\/strong> With the Dockerfiles and Docker Compose files in place, proceed to build your Docker images and deploy containers using the familiar Docker commands.<\/li>\n<\/ol>\n\n\n\n<p><iframe style=\"border-radius: 4px; border: 2px solid #e5e7eb; margin: 0; background-color: transparent;\" src=\"https:\/\/embeds.beehiiv.com\/6e19a1f8-8d19-4ec9-9ed7-ca858ff7ca76\" width=\"100%\" height=\"320\" frameborder=\"0\" scrolling=\"no\" data-test-id=\"beehiiv-embed\">&amp;amp;amp;amp;amp;amp;lt;!&#8211;kg-card-end: html&#8211;> &amp;amp;amp;amp;amp;amp;lt;h2 id=&#8221;dockerizing-nestjs-application&#8221;>Dockerizing NestJS Application&amp;amp;amp;amp;amp;amp;lt;\/h2> &amp;amp;amp;amp;amp;amp;lt;p>Let&#8217;s consider an &amp;amp;amp;amp;amp;amp;lt;a href=&#8221;https:\/\/github.com\/numerica-ideas\/community\/tree\/master\/docker\/quickly-dockerizing-nodejs&#8221;>API&amp;amp;amp;amp;amp;amp;lt;\/a> built with the NestJS framework powered by Node.js, feel free to use any other project or to generate a new one as we have done using the command &amp;amp;amp;amp;amp;amp;lt;code>nest new quickly-dockerizing-nodejs&amp;amp;amp;amp;amp;amp;lt;\/code> as illustrated below:&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;figure class=&#8221;kg-card kg-image-card kg-card-hascaption&#8221;>&amp;amp;amp;amp;amp;amp;lt;img src=&#8221;https:\/\/assets.numericaideas.com\/2023\/08\/generate-nestjs-project.png&#8221; class=&#8221;kg-image&#8221; alt=&#8221;Docker Init: Quickly Dockerizing NodeJS Application&#8221; \/>&amp;amp;amp;amp;amp;amp;lt;figcaption>Generate a NestJS project&amp;amp;amp;amp;amp;amp;lt;\/figcaption>&amp;amp;amp;amp;amp;amp;lt;\/figure> &amp;amp;amp;amp;amp;amp;lt;p>After running &amp;amp;amp;amp;amp;amp;lt;code>docker init&amp;amp;amp;amp;amp;amp;lt;\/code> in the project directory, the next step is to answer a few questions, generally, the first one is detected automatically (talking about the platform: Node), and by default, Nest uses &amp;amp;amp;amp;amp;amp;lt;code>dist&amp;amp;amp;amp;amp;amp;lt;\/code> as the output folder and the production command to start the App is &amp;amp;amp;amp;amp;amp;lt;code>npm run start:prod&amp;amp;amp;amp;amp;amp;lt;\/code> which starts the App on the port &amp;amp;amp;amp;amp;amp;lt;code>3000&amp;amp;amp;amp;amp;amp;lt;\/code>:&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;figure class=&#8221;kg-card kg-image-card kg-card-hascaption&#8221;>&amp;amp;amp;amp;amp;amp;lt;img src=&#8221;https:\/\/assets.numericaideas.com\/2023\/08\/run-docker-init.png&#8221; class=&#8221;kg-image&#8221; alt=&#8221;Docker Init: Quickly Dockerizing NodeJS Application&#8221; \/> &amp;amp;amp;amp;amp;amp;lt;figcaption>Run Docker init&amp;amp;amp;amp;amp;amp;lt;\/figcaption> &amp;amp;amp;amp;amp;amp;lt;p>&amp;amp;amp;amp;amp;amp;lt;\/p>&amp;amp;amp;amp;amp;amp;lt;\/figure> &amp;amp;amp;amp;amp;amp;lt;p>Finally, Docker generates the following &amp;amp;amp;amp;amp;amp;lt;a href=&#8221;https:\/\/github.com\/numerica-ideas\/community\/blob\/master\/docker\/quickly-dockerizing-nodejs\/Dockerfile&#8221;>&amp;amp;amp;amp;amp;amp;lt;code>Dockerfile&amp;amp;amp;amp;amp;amp;lt;\/code>&amp;amp;amp;amp;amp;amp;lt;\/a> for our NestJS Application:&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;pre>&amp;amp;amp;amp;amp;amp;lt;code># Dockerfile for the NestJS APInn# syntax=docker\/dockerfile:1nn# Comments are provided throughout this file to help you get started.n# If you need more help, visit the Dockerfile reference guide atn# https:\/\/docs.docker.com\/engine\/reference\/builder\/nnARG NODE_VERSION=18.12.0nn################################################################################n# Use node image for base image for all stages.nFROM node:${NODE_VERSION}-alpine as basenn# Set working directory for all build stages.nWORKDIR \/usr\/src\/appnn################################################################################n# Create a stage for installing production dependecies.nFROM base as depsnn# Download dependencies as a separate step to take advantage of Docker&#8217;s caching.n# Leverage a cache mount to \/root\/.npm to speed up subsequent builds.n# Leverage bind mounts to package.json and package-lock.json to avoid having to copy themn# into this layer.nRUN &#8211;mount=type=bind,source=package.json,target=package.json \\n    &#8211;mount=type=bind,source=package-lock.json,target=package-lock.json \\n    &#8211;mount=type=cache,target=\/root\/.npm \\n    npm ci &#8211;omit=devnn################################################################################n# Create a stage for building the application.nFROM deps as buildnn# Download additional development dependencies before building, as some projects requiren# &#8220;devDependencies&#8221; to be installed to build. If you don&#8217;t need this, remove this step.nRUN &#8211;mount=type=bind,source=package.json,target=package.json \\n    &#8211;mount=type=bind,source=package-lock.json,target=package-lock.json \\n    &#8211;mount=type=cache,target=\/root\/.npm \\n    npm cinn# Copy the rest of the source files into the image.nCOPY . .n# Run the build script.nRUN npm run buildnn################################################################################n# Create a new stage to run the application with minimal runtime dependenciesn# where the necessary files are copied from the build stage.nFROM base as finalnn# Use production node environment by default.nENV NODE_ENV productionnn# Run the application as a non-root user.nUSER nodenn# Copy package.json so that package manager commands can be used.nCOPY package.json .nn# Copy the production dependencies from the deps stage and alson# the built application from the build stage into the image.nCOPY &#8211;from=deps \/usr\/src\/app\/node_modules .\/node_modulesnCOPY &#8211;from=build \/usr\/src\/app\/dist .\/distnn# Expose the port that the application listens on.nEXPOSE 3000nn# Run the application.nCMD npm run start:prod&amp;amp;amp;amp;amp;amp;lt;\/code>&amp;amp;amp;amp;amp;amp;lt;\/pre> &amp;amp;amp;amp;amp;amp;lt;p>At the same time, the &amp;amp;amp;amp;amp;amp;lt;a href=&#8221;https:\/\/github.com\/numerica-ideas\/community\/blob\/master\/docker\/quickly-dockerizing-nodejs\/compose.yaml&#8221;>&amp;amp;amp;amp;amp;amp;lt;code>compose.yaml&amp;amp;amp;amp;amp;amp;lt;\/code>&amp;amp;amp;amp;amp;amp;lt;\/a> file is generated with the following content:&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;pre>&amp;amp;amp;amp;amp;amp;lt;code># Comments are provided throughout this file to help you get started.n# If you need more help, visit the Docker compose reference guide atn# https:\/\/docs.docker.com\/compose\/compose-file\/nn# Here the instructions define your application as a service called &#8220;server&#8221;.n# This service is built from the Dockerfile in the current directory.n# You can add other services your application may depend on here, such as an# database or a cache. For examples, see the Awesome Compose repository:n# https:\/\/github.com\/docker\/awesome-composenservices:n  server:n    build:n      context: .n    environment:n      NODE_ENV: productionn    ports:n      &#8211; 3000:3000nn# The commented out section below is an example of how to define a PostgreSQLn# database that your application can use. `depends_on` tells Docker Compose ton# start the database before your application. The `db-data` volume persists then# database data between container restarts. The `db-password` secret is usedn# to set the database password. You must create `db\/password.txt` and addn# a password of your choosing to it before running `docker-compose up`.n#     depends_on:n#       db:n#         condition: service_healthyn#   db:n#     image: postgresn#     restart: alwaysn#     user: postgresn#     secrets:n#       &#8211; db-passwordn#     volumes:n#       &#8211; db-data:\/var\/lib\/postgresql\/datan#     environment:n#       &#8211; POSTGRES_DB=examplen#       &#8211; POSTGRES_PASSWORD_FILE=\/run\/secrets\/db-passwordn#     expose:n#       &#8211; 5432n#     healthcheck:n#       test: [ &#8220;CMD&#8221;, &#8220;pg_isready&#8221; ]n#       interval: 10sn#       timeout: 5sn#       retries: 5n# volumes:n#   db-data:n# secrets:n#   db-password:n#     file: db\/password.txt&amp;amp;amp;amp;amp;amp;lt;\/code>&amp;amp;amp;amp;amp;amp;lt;\/pre> &amp;amp;amp;amp;amp;amp;lt;p>The generated Dockerfile and the Docker Compose file provide a basic setup to containerize both the &amp;amp;amp;amp;amp;amp;lt;strong>Node.js\/NestJS&amp;amp;amp;amp;amp;amp;lt;\/strong> web application and eventually a &amp;amp;amp;amp;amp;amp;lt;strong>PostgreSQL&amp;amp;amp;amp;amp;amp;lt;\/strong> service. You can then use these files as a starting point and customize them further based on your application&#8217;s specific requirements.&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;p>The complete source code of the project is available on &amp;amp;amp;amp;amp;amp;lt;a href=&#8221;https:\/\/github.com\/numerica-ideas\/community\/tree\/master\/docker\/quickly-dockerizing-nodejs&#8221;>GitHub&amp;amp;amp;amp;amp;amp;lt;\/a>.&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;h2 id=&#8221;run-the-application&#8221;>Run the Application&amp;amp;amp;amp;amp;amp;lt;\/h2> &amp;amp;amp;amp;amp;amp;lt;p>Let&#8217;s test the final result by running the App with the command &amp;amp;amp;amp;amp;amp;lt;code>docker compose up&amp;amp;amp;amp;amp;amp;lt;\/code> whose output is below:&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;figure class=&#8221;kg-card kg-image-card kg-card-hascaption&#8221;>&amp;amp;amp;amp;amp;amp;lt;img src=&#8221;https:\/\/assets.numericaideas.com\/2023\/08\/run-docker-compose-up.png&#8221; class=&#8221;kg-image&#8221; alt=&#8221;Docker Init: Quickly Dockerizing NodeJS Application&#8221; \/> &amp;amp;amp;amp;amp;amp;lt;figcaption>Run docker compose up&amp;amp;amp;amp;amp;amp;lt;\/figcaption> &amp;amp;amp;amp;amp;amp;lt;p>&amp;amp;amp;amp;amp;amp;lt;\/p>&amp;amp;amp;amp;amp;amp;lt;\/figure> &amp;amp;amp;amp;amp;amp;lt;p>The API is accessible at &amp;amp;amp;amp;amp;amp;lt;a href=&#8221;http:\/\/localhost:3000\/&#8221; rel=&#8221;nofollow&#8221;>http:\/\/localhost:3000&amp;amp;amp;amp;amp;amp;lt;\/a>:&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;figure class=&#8221;kg-card kg-image-card kg-card-hascaption&#8221;>&amp;amp;amp;amp;amp;amp;lt;img src=&#8221;https:\/\/assets.numericaideas.com\/2023\/08\/test-nestjs-api.png&#8221; class=&#8221;kg-image&#8221; alt=&#8221;Docker Init: Quickly Dockerizing NodeJS Application&#8221; \/> &amp;amp;amp;amp;amp;amp;lt;figcaption>Test NestJS API&amp;amp;amp;amp;amp;amp;lt;\/figcaption> &amp;amp;amp;amp;amp;amp;lt;p>&amp;amp;amp;amp;amp;amp;lt;\/p>&amp;amp;amp;amp;amp;amp;lt;\/figure> &amp;amp;amp;amp;amp;amp;lt;p>&amp;amp;amp;amp;amp;amp;lt;strong>Congratulations! You have successfully dockerized your NodeJS\/NestJS App with no effort while following best practices.&amp;amp;amp;amp;amp;amp;lt;\/strong>&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;p>If you are interested in related content, take a look at the following which explains how to &amp;amp;amp;amp;amp;amp;lt;a href=&#8221;https:\/\/blog.numericaideas.com\/docker-compose-springboot-mysql&#8221; rel=&#8221;nofollow&#8221;>Dockerize a Spring Boot Application with MySQL&amp;amp;amp;amp;amp;amp;lt;\/a>:&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;figure class=&#8221;kg-card kg-bookmark-card&#8221;>&amp;amp;amp;amp;amp;amp;lt;a class=&#8221;kg-bookmark-container&#8221; href=&#8221;https:\/\/blog.numericaideas.com\/docker-compose-springboot-mysql&#8221;> &amp;amp;amp;amp;amp;amp;lt;div class=&#8221;kg-bookmark-content&#8221;> &amp;amp;amp;amp;amp;amp;lt;div class=&#8221;kg-bookmark-title&#8221;>Dockerize Spring Boot and MySQL with Docker Compose&amp;amp;amp;amp;amp;amp;lt;\/div> &amp;amp;amp;amp;amp;amp;lt;div class=&#8221;kg-bookmark-description&#8221;>Let\u2019s explore how to dockerize a Spring Boot Application with MySQL by leveraging the power of Docker and Docker Compose to achieve easy deployment, improved portability, scalability, and version control.&amp;amp;amp;amp;amp;amp;lt;\/div> &amp;amp;amp;amp;amp;amp;lt;div class=&#8221;kg-bookmark-metadata&#8221;>&amp;amp;amp;amp;amp;amp;lt;img class=&#8221;kg-bookmark-icon&#8221; src=&#8221;https:\/\/s3.amazonaws.com\/ni-ghost\/2021\/05\/logo_numerica_ideas-1.png&#8221; alt=&#8221;Docker Init: Quickly Dockerizing NodeJS Application&#8221; \/>&amp;amp;amp;amp;amp;amp;lt;span class=&#8221;kg-bookmark-author&#8221;>Orleando Dassi&amp;amp;amp;amp;amp;amp;lt;\/span>&amp;amp;amp;amp;amp;amp;lt;span class=&#8221;kg-bookmark-publisher&#8221;>Dockerize Spring Boot and MySQL with Docker Compose&amp;amp;amp;amp;amp;amp;lt;\/span>&amp;amp;amp;amp;amp;amp;lt;\/div> &amp;amp;amp;amp;amp;amp;lt;\/div> &amp;amp;amp;amp;amp;amp;lt;div class=&#8221;kg-bookmark-thumbnail&#8221;>&amp;amp;amp;amp;amp;amp;lt;img src=&#8221;https:\/\/assets.numericaideas.com\/2023\/07\/Dockerize-Spring-Boot-Application-with-MySQL.png&#8221; alt=&#8221;Docker Init: Quickly Dockerizing NodeJS Application&#8221; \/>&amp;amp;amp;amp;amp;amp;lt;\/div> &amp;amp;amp;amp;amp;amp;lt;p>&amp;amp;amp;amp;amp;amp;lt;\/p>&amp;amp;amp;amp;amp;amp;lt;\/a>&amp;amp;amp;amp;amp;amp;lt;\/figure> &amp;amp;amp;amp;amp;amp;lt;p>\u2014\u2014\u2014\u2014\u2014\u2014\u2014&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;p>We have just started our journey to build a network of professionals to grow even more our free knowledge-sharing community that\u2019ll give you a chance to learn interesting things about topics like cloud computing, software development, and software architectures while keeping the door open to more opportunities.&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;p>Does this speak to you? If &amp;amp;amp;amp;amp;amp;lt;strong>YES&amp;amp;amp;amp;amp;amp;lt;\/strong>, feel free to &amp;amp;amp;amp;amp;amp;lt;a href=&#8221;https:\/\/discord.numericaideas.com\/&#8221; rel=&#8221;nofollow&#8221;>Join our Discord Server&amp;amp;amp;amp;amp;amp;lt;\/a> to stay in touch with the community and be part of independently organized events.&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;p>\u2014\u2014\u2014\u2014\u2014\u2014\u2014&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;h2 id=&#8221;conclusion&#8221;>Conclusion&amp;amp;amp;amp;amp;amp;lt;\/h2> &amp;amp;amp;amp;amp;amp;lt;p>Docker Init simplifies and expedites the containerization process by providing a convenient method to generate Dockerfiles and Docker Compose files. By using this single CLI command, developers can save time, maintain standardization, and focus on the crucial aspects of application development and deployment. Whether you are a Docker novice or an experienced user, &amp;amp;amp;amp;amp;amp;lt;code>docker init&amp;amp;amp;amp;amp;amp;lt;\/code> proves to be a valuable tool in streamlining your containerization workflow. So, give it a try and experience the efficiency and simplicity it brings to your container-based projects. Happy containerizing!&amp;amp;amp;amp;amp;amp;lt;\/p> &amp;amp;amp;amp;amp;amp;lt;p>Thanks for reading this article. Like, recommend, and share if you enjoyed it. Follow us on &amp;amp;amp;amp;amp;amp;lt;a href=&#8221;https:\/\/www.facebook.com\/numericaideas&#8221; rel=&#8221;nofollow&#8221;>Facebook&amp;amp;amp;amp;amp;amp;lt;\/a>, &amp;amp;amp;amp;amp;amp;lt;a href=&#8221;https:\/\/twitter.com\/numericaideas&#8221; rel=&#8221;nofollow&#8221;>Twitter&amp;amp;amp;amp;amp;amp;lt;\/a>, and &amp;amp;amp;amp;amp;amp;lt;a href=&#8221;https:\/\/www.linkedin.com\/company\/numericaideas&#8221; rel=&#8221;nofollow&#8221;>LinkedIn&amp;amp;amp;amp;amp;amp;lt;\/a> for more content.&amp;amp;amp;amp;amp;amp;lt;\/p><\/iframe><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"dockerizing-nestjs-application\">Dockerizing NestJS Application<\/h2>\n\n\n\n<p>Let&#8217;s consider an&nbsp;<a href=\"https:\/\/github.com\/numerica-ideas\/community\/tree\/master\/docker\/quickly-dockerizing-nodejs\">API<\/a>&nbsp;built with the NestJS framework powered by Node.js, feel free to use any other project or to generate a new one as we have done using the command&nbsp;<code>nest new quickly-dockerizing-nodejs<\/code>&nbsp;as illustrated below:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/assets.numericaideas.com\/2023\/08\/generate-nestjs-project.png\" alt=\"generate-nestjs-project\"\/><figcaption class=\"wp-element-caption\">Generate a NestJS project<\/figcaption><\/figure>\n\n\n\n<p>After running&nbsp;<code>docker init<\/code>&nbsp;in the project directory, the next step is to answer a few questions, generally, the first one is detected automatically (talking about the platform: Node), and by default, Nest uses&nbsp;<code>dist<\/code>&nbsp;as the output folder and the production command to start the App is&nbsp;<code>npm run start:prod<\/code>&nbsp;which starts the App on the port&nbsp;<code>3000<\/code>:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/assets.numericaideas.com\/2023\/08\/run-docker-init.png\" alt=\"run-docker-init\"\/><figcaption class=\"wp-element-caption\">Run Docker init<\/figcaption><\/figure>\n\n\n\n<p>Finally, Docker generates the following&nbsp;<a href=\"https:\/\/github.com\/numerica-ideas\/community\/blob\/master\/docker\/quickly-dockerizing-nodejs\/Dockerfile\"><code>Dockerfile<\/code><\/a>&nbsp;for our NestJS Application:<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\"># Dockerfile for the NestJS API\n# syntax=docker\/dockerfile:1\n# Comments are provided throughout this file to help you get started.\n# If you need more help, visit the Dockerfile reference guide at\n# https:\/\/docs.docker.com\/engine\/reference\/builder\/\nARG NODE_VERSION=18.12.0\n################################################################################\n# Use node image for base image for all stages.\nFROM node:${NODE_VERSION}-alpine as base\n# Set working directory for all build stages.\nWORKDIR \/usr\/src\/app\n################################################################################\n# Create a stage for installing production dependecies.\nFROM base as deps\n# Download dependencies as a separate step to take advantage of Docker's caching.\n# Leverage a cache mount to \/root\/.npm to speed up subsequent builds.\n# Leverage bind mounts to package.json and package-lock.json to avoid having to copy them\n# into this layer.\nRUN --mount=type=bind,source=package.json,target=package.json \\\n    --mount=type=bind,source=package-lock.json,target=package-lock.json \\\n    --mount=type=cache,target=\/root\/.npm \\\n    npm ci --omit=dev\n################################################################################\n# Create a stage for building the application.\nFROM deps as build\n# Download additional development dependencies before building, as some projects require\n# \"devDependencies\" to be installed to build. If you don't need this, remove this step.\nRUN --mount=type=bind,source=package.json,target=package.json \\\n    --mount=type=bind,source=package-lock.json,target=package-lock.json \\\n    --mount=type=cache,target=\/root\/.npm \\\n    npm ci\n# Copy the rest of the source files into the image.\nCOPY . .\n# Run the build script.\nRUN npm run build\n################################################################################\n# Create a new stage to run the application with minimal runtime dependencies\n# where the necessary files are copied from the build stage.\nFROM base as final\n# Use production node environment by default.\nENV NODE_ENV production\n# Run the application as a non-root user.\nUSER node\n# Copy package.json so that package manager commands can be used.\nCOPY package.json .\n# Copy the production dependencies from the deps stage and also\n# the built application from the build stage into the image.\nCOPY --from=deps \/usr\/src\/app\/node_modules .\/node_modules\nCOPY --from=build \/usr\/src\/app\/dist .\/dist\n# Expose the port that the application listens on.\nEXPOSE 3000\n# Run the application.\nCMD npm run start:prod<\/pre>\n\n\n\n<p>At the same time, the&nbsp;<a href=\"https:\/\/github.com\/numerica-ideas\/community\/blob\/master\/docker\/quickly-dockerizing-nodejs\/compose.yaml\"><code>compose.yaml<\/code><\/a>&nbsp;file is generated with the following content:<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\"># Comments are provided throughout this file to help you get started.\n# If you need more help, visit the Docker compose reference guide at\n# https:\/\/docs.docker.com\/compose\/compose-file\/\n# Here the instructions define your application as a service called \"server\".\n# This service is built from the Dockerfile in the current directory.\n# You can add other services your application may depend on here, such as a\n# database or a cache. For examples, see the Awesome Compose repository:\n# https:\/\/github.com\/docker\/awesome-compose\nservices:\n  server:\n    build:\n      context: .\n    environment:\n      NODE_ENV: production\n    ports:\n      - 3000:3000\n# The commented out section below is an example of how to define a PostgreSQL\n# database that your application can use. `depends_on` tells Docker Compose to\n# start the database before your application. The `db-data` volume persists the\n# database data between container restarts. The `db-password` secret is used\n# to set the database password. You must create `db\/password.txt` and add\n# a password of your choosing to it before running `docker-compose up`.\n#     depends_on:\n#       db:\n#         condition: service_healthy\n#   db:\n#     image: postgres\n#     restart: always\n#     user: postgres\n#     secrets:\n#       - db-password\n#     volumes:\n#       - db-data:\/var\/lib\/postgresql\/data\n#     environment:\n#       - POSTGRES_DB=example\n#       - POSTGRES_PASSWORD_FILE=\/run\/secrets\/db-password\n#     expose:\n#       - 5432\n#     healthcheck:\n#       test: [ \"CMD\", \"pg_isready\" ]\n#       interval: 10s\n#       timeout: 5s\n#       retries: 5\n# volumes:\n#   db-data:\n# secrets:\n#   db-password:\n#     file: db\/password.txt<\/pre>\n\n\n\n<p>The generated Dockerfile and the Docker Compose file provide a basic setup to containerize both the&nbsp;<strong>Node.js\/NestJS<\/strong>&nbsp;web application and eventually a&nbsp;<strong>PostgreSQL<\/strong>&nbsp;service. You can then use these files as a starting point and customize them further based on your application&#8217;s specific requirements.<\/p>\n\n\n\n<p>The complete source code of the project is available on&nbsp;<a href=\"https:\/\/github.com\/numerica-ideas\/community\/tree\/master\/docker\/quickly-dockerizing-nodejs\">GitHub<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"run-the-application\">Run the Application<\/h2>\n\n\n\n<p>Let&#8217;s test the final result by running the App with the command&nbsp;<code>docker compose up<\/code>&nbsp;whose output is below:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/assets.numericaideas.com\/2023\/08\/run-docker-compose-up.png\" alt=\"run-docker-compose-up\"\/><figcaption class=\"wp-element-caption\">Run docker compose up<\/figcaption><\/figure>\n\n\n\n<p>The API is accessible at&nbsp;<a href=\"http:\/\/localhost:3000\/\">http:\/\/localhost:3000<\/a>:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/assets.numericaideas.com\/2023\/08\/test-nestjs-api.png\" alt=\"test-nestjs-api\"\/><figcaption class=\"wp-element-caption\">Test NestJS API<\/figcaption><\/figure>\n\n\n\n<p><strong>Congratulations! You have successfully dockerized your NodeJS\/NestJS App with no effort while following best practices.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Other Docker Compose Examples<\/h2>\n\n\n\n<p>If you are interested in related content, take a look at the following which explains how to&nbsp;<a href=\"https:\/\/numericaideas.com\/blog\/docker-compose-springboot-mysql\/\" target=\"_blank\" rel=\"noreferrer noopener\">Dockerize a Spring Boot Application with MySQL<\/a>:<\/p>\n\n\n<div class=\"vlp-link-container vlp-layout-basic wp-block-visual-link-preview-link\"><a href=\"https:\/\/numericaideas.com\/blog\/docker-compose-springboot-mysql\/\" class=\"vlp-link\" title=\"Dockerize Spring Boot and MySQL with Docker Compose\" rel=\"nofollow\" target=\"_blank\"><\/a><div class=\"vlp-layout-zone-side\"><div class=\"vlp-block-2 vlp-link-image\"><img decoding=\"async\" src=\"https:\/\/assets.numericaideas.com\/2023\/07\/Dockerize-Spring-Boot-Application-with-MySQL-1-min.png\" style=\"max-width: 150px; max-height: 150px\" \/><\/div><\/div><div class=\"vlp-layout-zone-main\"><div class=\"vlp-block-0 vlp-link-title\">Dockerize Spring Boot and MySQL with Docker Compose<\/div><div class=\"vlp-block-1 vlp-link-summary\">Let\u2019s explore how to dockerize a Spring Boot Application with MySQL by leveraging the power of Docker and Docker Compose to achieve easy deployment, improved portability, scalability, and version control.<\/div><\/div><\/div>\n\n\n<p>Do you want to apply the same with a Spring Boot Application? Read this article titled&nbsp;<a href=\"https:\/\/numericaideas.com\/blog\/docker-compose-nodejs-mysql\" target=\"_blank\" rel=\"noreferrer noopener\">Dockerize NodeJS and MySQL with Docker Compose<\/a>:<\/p>\n\n\n<div class=\"vlp-link-container vlp-layout-basic wp-block-visual-link-preview-link\"><a href=\"https:\/\/numericaideas.com\/blog\/docker-compose-nodejs-mysql\" class=\"vlp-link\" title=\"Dockerize NodeJS and MySQL with Docker Compose\" rel=\"nofollow\" target=\"_blank\"><\/a><div class=\"vlp-layout-zone-side\"><div class=\"vlp-block-2 vlp-link-image\"><img decoding=\"async\" src=\"https:\/\/assets.numericaideas.com\/2024\/01\/Dockerize-NodeJS-Application-with-MySQL.png\" style=\"max-width: 150px; max-height: 150px\" \/><\/div><\/div><div class=\"vlp-layout-zone-main\"><div class=\"vlp-block-0 vlp-link-title\">Dockerize NodeJS and MySQL with Docker Compose<\/div><div class=\"vlp-block-1 vlp-link-summary\">Let\u2019s Dockerize a NodeJS Application with MySQL by leveraging the power of Docker Compose to achieve easy deployment and portability.<\/div><\/div><\/div>\n\n\n<p>\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/p>\n\n\n\n<p>We have just started our journey to build a network of professionals to grow our free knowledge-sharing community that\u2019ll give you a chance to learn interesting things about topics like cloud computing, software development, and software architectures while keeping the door open to more opportunities.<\/p>\n\n\n\n<p>Does this speak to you? If&nbsp;<strong>YES<\/strong>, feel free to&nbsp;<a href=\"https:\/\/discord.numericaideas.com\/\">Join our Discord Server<\/a>&nbsp;to stay in touch with the community and be part of independently organized events.<\/p>\n\n\n\n<p>\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>Docker Init simplifies and expedites the containerization process by providing a convenient method to generate Dockerfiles and Docker Compose files. By using this single CLI command, developers can save time, maintain standardization, and focus on the crucial aspects of application development and deployment. Whether you are a Docker novice or an experienced user,&nbsp;<code>docker init<\/code>&nbsp;proves to be a valuable tool in streamlining your containerization workflow. So, give it a try and experience the efficiency and simplicity it brings to your container-based projects. Happy containerizing!<\/p>\n\n\n\n<p>Thanks for reading this article. Like, recommend, and share if you enjoyed it. Follow us on&nbsp;<a href=\"https:\/\/www.facebook.com\/numericaideas\">Facebook<\/a>,&nbsp;<a href=\"https:\/\/twitter.com\/numericaideas\">Twitter<\/a>, and&nbsp;<a href=\"https:\/\/www.linkedin.com\/company\/numericaideas\">LinkedIn<\/a>&nbsp;for more content.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The docker init command is a powerful tool that enables developers to generate Dockerfiles and Docker Compose files effortlessly.<\/p>","protected":false},"author":2,"featured_media":18678,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64],"tags":[55,38],"class_list":["post-17174","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","tag-docker","tag-nodejs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Docker Init: Quickly Dockerizing NodeJS Application<\/title>\n<meta name=\"description\" content=\"The docker init command is a powerful tool that enables developers to generate Dockerfiles and Docker Compose files effortlessly.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/\" \/>\n<meta property=\"og:locale\" content=\"fr_CA\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker Init: Quickly Dockerizing NodeJS Application\" \/>\n<meta property=\"og:description\" content=\"The docker init command is a powerful tool that enables developers to generate Dockerfiles and Docker Compose files effortlessly.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/\" \/>\n<meta property=\"og:site_name\" content=\"Orleando Dassi\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-03T19:56:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-07T03:35:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dassiorleando.com\/wp-content\/uploads\/2023\/08\/quickly-dockerizing-nodejs-min.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Orl\u00e9ando Dassi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dassiorleando\" \/>\n<meta name=\"twitter:site\" content=\"@dassiorleando\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Orl\u00e9ando Dassi\" \/>\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:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/dassiorleando.com\/quickly-dockerizing-nodejs\/\"},\"author\":{\"name\":\"Orl\u00e9ando Dassi\",\"@id\":\"https:\/\/dassiorleando.com\/#\/schema\/person\/4862911e9cf93aa12f17875f7b7b1c5e\"},\"headline\":\"Docker Init: Quickly Dockerizing NodeJS Application\",\"datePublished\":\"2023-08-03T19:56:16+00:00\",\"dateModified\":\"2025-01-07T03:35:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/dassiorleando.com\/quickly-dockerizing-nodejs\/\"},\"wordCount\":3567,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/dassiorleando.com\/#\/schema\/person\/4862911e9cf93aa12f17875f7b7b1c5e\"},\"image\":{\"@id\":\"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dassiorleando.com\/wp-content\/uploads\/2023\/08\/quickly-dockerizing-nodejs-min.png\",\"keywords\":[\"Docker\",\"NodeJS\"],\"articleSection\":[\"DevOps\"],\"inLanguage\":\"fr-CA\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dassiorleando.com\/quickly-dockerizing-nodejs\/\",\"url\":\"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/\",\"name\":\"Docker Init: Quickly Dockerizing NodeJS Application\",\"isPartOf\":{\"@id\":\"https:\/\/dassiorleando.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dassiorleando.com\/wp-content\/uploads\/2023\/08\/quickly-dockerizing-nodejs-min.png\",\"datePublished\":\"2023-08-03T19:56:16+00:00\",\"dateModified\":\"2025-01-07T03:35:03+00:00\",\"description\":\"The docker init command is a powerful tool that enables developers to generate Dockerfiles and Docker Compose files effortlessly.\",\"breadcrumb\":{\"@id\":\"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#breadcrumb\"},\"inLanguage\":\"fr-CA\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-CA\",\"@id\":\"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#primaryimage\",\"url\":\"https:\/\/dassiorleando.com\/wp-content\/uploads\/2023\/08\/quickly-dockerizing-nodejs-min.png\",\"contentUrl\":\"https:\/\/dassiorleando.com\/wp-content\/uploads\/2023\/08\/quickly-dockerizing-nodejs-min.png\",\"width\":1366,\"height\":768,\"caption\":\"Docker Init: Quickly Dockerizing NodeJS Application\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dassiorleando.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Docker Init: Quickly Dockerizing NodeJS Application\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dassiorleando.com\/#website\",\"url\":\"https:\/\/dassiorleando.com\/\",\"name\":\"Orleando Dassi\",\"description\":\"My personal portfolio and resume\",\"publisher\":{\"@id\":\"https:\/\/dassiorleando.com\/#\/schema\/person\/4862911e9cf93aa12f17875f7b7b1c5e\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dassiorleando.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-CA\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/dassiorleando.com\/#\/schema\/person\/4862911e9cf93aa12f17875f7b7b1c5e\",\"name\":\"Orl\u00e9ando Dassi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-CA\",\"@id\":\"https:\/\/dassiorleando.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/dassiorleando.com\/wp-content\/uploads\/2025\/01\/Orleando-Dassi-Consultant-Quebec.webp\",\"contentUrl\":\"https:\/\/dassiorleando.com\/wp-content\/uploads\/2025\/01\/Orleando-Dassi-Consultant-Quebec.webp\",\"width\":1643,\"height\":1747,\"caption\":\"Orl\u00e9ando Dassi\"},\"logo\":{\"@id\":\"https:\/\/dassiorleando.com\/#\/schema\/person\/image\/\"},\"description\":\"I'm a Solutions Architect with 10 years of experience who is constantly learning while impacting the community by producing technical articles\/videos, building projects, and conducting tech mentoring\/coaching sessions. What describes me the most is my flexibility.\",\"sameAs\":[\"https:\/\/dassiorleando.com\/\",\"https:\/\/www.instagram.com\/dassiorleando\/\",\"https:\/\/www.linkedin.com\/in\/dassi-orleando-257b04ab\/\",\"https:\/\/x.com\/dassiorleando\",\"https:\/\/www.youtube.com\/@dassiorleando\"],\"url\":\"https:\/\/dassiorleando.com\/fr\/author\/dassiorleando\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Docker Init: Quickly Dockerizing NodeJS Application","description":"The docker init command is a powerful tool that enables developers to generate Dockerfiles and Docker Compose files effortlessly.","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:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/","og_locale":"fr_CA","og_type":"article","og_title":"Docker Init: Quickly Dockerizing NodeJS Application","og_description":"The docker init command is a powerful tool that enables developers to generate Dockerfiles and Docker Compose files effortlessly.","og_url":"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/","og_site_name":"Orleando Dassi","article_published_time":"2023-08-03T19:56:16+00:00","article_modified_time":"2025-01-07T03:35:03+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/dassiorleando.com\/wp-content\/uploads\/2023\/08\/quickly-dockerizing-nodejs-min.png","type":"image\/png"}],"author":"Orl\u00e9ando Dassi","twitter_card":"summary_large_image","twitter_creator":"@dassiorleando","twitter_site":"@dassiorleando","twitter_misc":{"Written by":"Orl\u00e9ando Dassi","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#article","isPartOf":{"@id":"https:\/\/dassiorleando.com\/quickly-dockerizing-nodejs\/"},"author":{"name":"Orl\u00e9ando Dassi","@id":"https:\/\/dassiorleando.com\/#\/schema\/person\/4862911e9cf93aa12f17875f7b7b1c5e"},"headline":"Docker Init: Quickly Dockerizing NodeJS Application","datePublished":"2023-08-03T19:56:16+00:00","dateModified":"2025-01-07T03:35:03+00:00","mainEntityOfPage":{"@id":"https:\/\/dassiorleando.com\/quickly-dockerizing-nodejs\/"},"wordCount":3567,"commentCount":0,"publisher":{"@id":"https:\/\/dassiorleando.com\/#\/schema\/person\/4862911e9cf93aa12f17875f7b7b1c5e"},"image":{"@id":"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#primaryimage"},"thumbnailUrl":"https:\/\/dassiorleando.com\/wp-content\/uploads\/2023\/08\/quickly-dockerizing-nodejs-min.png","keywords":["Docker","NodeJS"],"articleSection":["DevOps"],"inLanguage":"fr-CA","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/dassiorleando.com\/quickly-dockerizing-nodejs\/","url":"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/","name":"Docker Init: Quickly Dockerizing NodeJS Application","isPartOf":{"@id":"https:\/\/dassiorleando.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#primaryimage"},"image":{"@id":"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#primaryimage"},"thumbnailUrl":"https:\/\/dassiorleando.com\/wp-content\/uploads\/2023\/08\/quickly-dockerizing-nodejs-min.png","datePublished":"2023-08-03T19:56:16+00:00","dateModified":"2025-01-07T03:35:03+00:00","description":"The docker init command is a powerful tool that enables developers to generate Dockerfiles and Docker Compose files effortlessly.","breadcrumb":{"@id":"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#breadcrumb"},"inLanguage":"fr-CA","potentialAction":[{"@type":"ReadAction","target":["https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/"]}]},{"@type":"ImageObject","inLanguage":"fr-CA","@id":"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#primaryimage","url":"https:\/\/dassiorleando.com\/wp-content\/uploads\/2023\/08\/quickly-dockerizing-nodejs-min.png","contentUrl":"https:\/\/dassiorleando.com\/wp-content\/uploads\/2023\/08\/quickly-dockerizing-nodejs-min.png","width":1366,"height":768,"caption":"Docker Init: Quickly Dockerizing NodeJS Application"},{"@type":"BreadcrumbList","@id":"https:\/\/numericaideas.com\/blog\/quickly-dockerizing-nodejs\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dassiorleando.com\/"},{"@type":"ListItem","position":2,"name":"Docker Init: Quickly Dockerizing NodeJS Application"}]},{"@type":"WebSite","@id":"https:\/\/dassiorleando.com\/#website","url":"https:\/\/dassiorleando.com\/","name":"Orleando Dassi","description":"My personal portfolio and resume","publisher":{"@id":"https:\/\/dassiorleando.com\/#\/schema\/person\/4862911e9cf93aa12f17875f7b7b1c5e"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dassiorleando.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-CA"},{"@type":["Person","Organization"],"@id":"https:\/\/dassiorleando.com\/#\/schema\/person\/4862911e9cf93aa12f17875f7b7b1c5e","name":"Orl\u00e9ando Dassi","image":{"@type":"ImageObject","inLanguage":"fr-CA","@id":"https:\/\/dassiorleando.com\/#\/schema\/person\/image\/","url":"https:\/\/dassiorleando.com\/wp-content\/uploads\/2025\/01\/Orleando-Dassi-Consultant-Quebec.webp","contentUrl":"https:\/\/dassiorleando.com\/wp-content\/uploads\/2025\/01\/Orleando-Dassi-Consultant-Quebec.webp","width":1643,"height":1747,"caption":"Orl\u00e9ando Dassi"},"logo":{"@id":"https:\/\/dassiorleando.com\/#\/schema\/person\/image\/"},"description":"I'm a Solutions Architect with 10 years of experience who is constantly learning while impacting the community by producing technical articles\/videos, building projects, and conducting tech mentoring\/coaching sessions. What describes me the most is my flexibility.","sameAs":["https:\/\/dassiorleando.com\/","https:\/\/www.instagram.com\/dassiorleando\/","https:\/\/www.linkedin.com\/in\/dassi-orleando-257b04ab\/","https:\/\/x.com\/dassiorleando","https:\/\/www.youtube.com\/@dassiorleando"],"url":"https:\/\/dassiorleando.com\/fr\/author\/dassiorleando\/"}]}},"_links":{"self":[{"href":"https:\/\/dassiorleando.com\/fr\/wp-json\/wp\/v2\/posts\/17174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dassiorleando.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dassiorleando.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dassiorleando.com\/fr\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dassiorleando.com\/fr\/wp-json\/wp\/v2\/comments?post=17174"}],"version-history":[{"count":1,"href":"https:\/\/dassiorleando.com\/fr\/wp-json\/wp\/v2\/posts\/17174\/revisions"}],"predecessor-version":[{"id":21659,"href":"https:\/\/dassiorleando.com\/fr\/wp-json\/wp\/v2\/posts\/17174\/revisions\/21659"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dassiorleando.com\/fr\/wp-json\/wp\/v2\/media\/18678"}],"wp:attachment":[{"href":"https:\/\/dassiorleando.com\/fr\/wp-json\/wp\/v2\/media?parent=17174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dassiorleando.com\/fr\/wp-json\/wp\/v2\/categories?post=17174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dassiorleando.com\/fr\/wp-json\/wp\/v2\/tags?post=17174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}