When I perform a npm install -g in a Docker container, will it only affect the container or will it actually install the package on the host of the container?
Regards.
When I perform a npm install -g in a Docker container, will it only affect the container or will it actually install the package on the host of the container?
Regards.
You can assume, for most cases, it will affect only the container, unless you map your npm global directory as a volume from the host to the container at run command, for example:
docker run [...] -v /usr/lib/node_modules/:/usr/lib/ [...]
Everything that you run inside a docker will affect only the container, that will affect the host only if you explicit mount the host dir on the docker.
Doing something like that: docker run [...] -v /home/youruser/wwwtest:/wwwtest In this example you will run the npm install on wwwtest of the docker and will affect the local dir /home/youruser/wwwtest.
But like I said, only if you've used this option.