When developing code that will eventually be running in a container, it is often the best approach to run the code in the container from the very beginning, to make sure there will be no unexpected surprises. But, we have to do this in the right way in order not to introduce any unnecessary friction into our development process. Let's first look at a naive way that we could run and test code in a container:
- Create a new project folder and navigate to it:
$ mkdir -p ~/fod/ch06 && cd ~/fod/ch06
- Let's use npm to create a new Node.js project:
$ npm init
- Accept all the defaults. Notice that a package.json file is created with the following content:
{
"name": "ch06",
"version": "1.0.0",
"description": "",
"main": "index.js...