In this article, we will dive into the process of setting up a simple Node.js application using Docker. Whether you’re starting a new project or looking to Dockerize an existing one, this guide provides a user-friendly approach.
Table of Contents
- Tech Stack
- Notable Opinions and Packages
- Running This App
- Files of Interest
- Updating Dependencies
- Additional Resources
Tech Stack
This example utilizes several robust technologies:
Back-end
Front-end
Notable Opinions and Packages
Express is a highly flexible framework, and the design choices made in this application are based on experience with various web frameworks. Below are some key packages used:
- Morgan – for logging HTTP requests
- Express EJS Layouts – for using layouts in EJS templates
- Nodemon – for code reloading in development
- ESLint – for code linting
- Jest – for testing
Running This App
To get started, you’ll need to have Docker installed on your machine. The application can be run on Windows, macOS, or most Linux distributions. Follow the steps below:
git clone https://github.com/nickjj/docker-node-example hellonode
cd hellonode
cp .env.example .env
docker compose up --build
Now, your application should be running! You can visit http://localhost:8000 in your web browser to see it in action.
Troubleshooting Common Issues
- Docker Compose Error: If you receive an error stating “depends_on Additional property required is not allowed,” ensure you are using Docker Compose v2.20.2+.
- Port Issues: If you encounter errors related to port 8000 being in use, check your
.envfile for theDOCKER_WEB_PORT_FORWARDvariable and adjust it as needed. - Permission Issues: For native Linux users, if permission denied errors occur, verify your
uid:gidusingidand update the.envfile accordingly.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Files of Interest
In addition to the basic setup, take a look at:
.env: This file holds your environment variables. Customize it to manage configurations and secrets.run: A shell script that provides additional commands to interact with your project easily.
Updating Dependencies
To keep your app up to date without hassle, use Docker commands:
run yarn:outdated
run yarn:install
This keeps your dependencies managed seamlessly through Docker.
Additional Resources
Now that you have your app set up and running, you can explore:
- Docker Documentation
- Express Documentation
- Dive Into Docker Course – Comprehensive insights into Docker and Docker Compose
Conclusion
By following these steps, you now have a wonderful base for your Node.js application running inside a Docker container. This setup will not only help in development but also ease the transition into a production environment.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

