How to implement NPM link command with dockerized apps?

  docker, kubernetes, node.js, npm, skaffold

My app uses my own common module which already on the npm registry. In order to see changes take affect immediately, instead of actually push a new version to the npm registry, I go to the common module directory and run: npm link then go back to my app and instead of actually bump the version and install it anytime there a change in the development, I just run: npm link MY-MODULE-NAME

When working without Docker everything works perfect. since there only one global node_modules on my disk.

But when running my app inside a Docker container, the link tries to find my module, but in the node_modules dir under the container my module is missing, of course.

How to solve this? I don’t want to build and push changes to actual npm registry just for dev purposes.

My env stack: My app is running inside a Docker container inside a Kubernetes pod and all of that runs in a local cluster using Minikube and handled automatically by Skaffold.

Source: Docker Questions