DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • 7 Ways of Containerizing Your Node.js Application
  • Deploy an Application for Azure Container Registry
  • How to Setup MuleSoft Runtime Fabric on Self-Managed Kubernetes With AKS
  • AppOps with Kubernetes and Devtron - The Perfect Fit

Trending

  • The Smart Way to Talk to Your Database: Why Hybrid API + NL2SQL Wins
  • Vibe Coding With GitHub Copilot: Optimizing API Performance in Fintech Microservices
  • Developers Beware: Slopsquatting and Vibe Coding Can Increase Risk of AI-Powered Attacks
  • Enforcing Architecture With ArchUnit in Java
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. How To Use the Node Docker Official Image

How To Use the Node Docker Official Image

A step-by-step tutorial on how to create a Docker container using the official image of Node that will make your work process easier and more productive.

By 
Charles Ituah user avatar
Charles Ituah
·
May. 17, 23 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
4.1K Views

Join the DZone community and get the full member experience.

Join For Free

What Is Node.js?

Node.js, which is a crucial component of the MERN stack, has continued to expand in popularity and has topped Stack Overflow's list of the most popular web frameworks and technologies for 2022. Since Node.js applications are written in JavaScript, which is the world's leading programming language, many developers will find it easy to use. To address common development challenges and to cater to the popularity of Node.js, we introduced the Node Docker Official Image (DOI). 

What Is the Node Docker Official Image?

The Node Docker Official Image comes with all the necessary components, including source code, core dependencies, tools, and libraries, to ensure that your application runs smoothly. It is designed to support various CPU architectures such as amd64, arm32v6, arm32v7, arm64v8, ppc641le, and s390x. Additionally, you have the freedom to select different tags or image versions for your project. Opting for a specific version like node:19.0.0-slim ensures that you use a stable and efficient version of Node.js. 

How To Run Node in Docker

To begin with, you should download and install your preferred Docker Desktop release. Docker Desktop comprises the Docker CLI, Docker Compose, and other essential development tools. Moreover, the Docker Dashboard, which is the UI component of Docker Desktop, will assist you in managing containers and images.

Enter a Quick Pull Command

Pulling the Node DOI is the quickest way to begin. Enter this command in your terminal.

Dockerfile
 
docker pull node


This grabs the default latest Node version from Docker Hub. You can readily use this tag for testing or local development. 

After the CLI completes the task, it will show a status message. Additionally, you can verify this by going to Docker Desktop. To do this, navigate to the Images tab on the left sidebar and look through the list of images. Your node image will be displayed by Docker Desktop. 

Confirm That Node Is Functional and Working

Are you interested in running your newly created image as a container? If so, simply hover over the listed node image and click on the blue "Run" button. Once you do this, your Node container will generate basic log entries and operate continuously in case any requests are received. 

Create Your Node Image From a Dockerfile

By building from a Dockerfile, you can have complete authority over the composition and configuration of your image, as well as your overall application. Nevertheless, Node has minimal requirements for proper functioning. To help you get started and running, here is a Dockerfile that is stripped down (using a particular, Debian-based image version): 

Dockerfile
 
FROM node:19-bullseye


To create your image, Docker will utilize the Node version you have selected. It is recommended to opt for node:19-bullseye as it is a reliable image that caters to various use cases. Furthermore, this version is stable and safeguards you against any new disruptive modifications that can occur with the use of the latest tags.

 To build your image from a Dockerfile, run this command:

Dockerfile
 
docker build -t my-nodejs-app .


You can then run your new image by entering this command:

Dockerfile
 
docker run -it --rm --name my-running-app my-nodejs-app


Node.js application Command (computing) Docker (software)

Opinions expressed by DZone contributors are their own.

Related

  • 7 Ways of Containerizing Your Node.js Application
  • Deploy an Application for Azure Container Registry
  • How to Setup MuleSoft Runtime Fabric on Self-Managed Kubernetes With AKS
  • AppOps with Kubernetes and Devtron - The Perfect Fit

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!