You will learn how to create your own images that will include all the source code of your application, along with a specific version of Node.js and all the dependencies that are needed. Once you are done, you will be able to share this image with other people and this will ensure that everyone is running the same environment. It will event let people that don’t have Node.js run this server. This will also have the added benefit of cleaning up everything once you close the application.
You'll notice that we will run into the same error stating we can't connect to the database. This is expected and we'll fix this in Allow Container to Communicate through Docker Networks
On an Arm-based Mac I had some issues building the canvas package within the Docker container. Seems to be a common issue. What finally worked for me was to update the node version to 18 ( update first line to FROM node:18 ) and install a couple libs in the container just before the RUN npm install line: RUN apt-get update && apt-get install libcairo-dev libpango1.0-dev -y