Evolving and testing code running in a container

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:

  1. Create a new project folder and navigate to it:
$ mkdir -p ~/fod/ch06 && cd ~/fod/ch06
  1. Let's use npm to create a new Node.js project:
$ npm init
  1. Accept all the defaults. Notice that a package.json file is created with the following content:
{  "name": "ch06",  "version": "1.0.0", "description": ...

Get Learn Docker - Fundamentals of Docker 19.x - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.