@@ -53,6 +53,51 @@ $ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/app -w
5353/usr/src/app node:4 node your-daemon-or-script.js
5454```
5555
56+ ## Verbosity
57+
58+ By default the Node.js Docker Image has npm log verbosity set to ` info ` instead
59+ of the default ` warn ` . This is because of the way Docker is isolated from the
60+ host operating system and you are not guaranteed to be able to retrieve the
61+ ` npm-debug.log ` file when npm fails.
62+
63+ When npm fails, it writes it's verbose log to a log file inside the container.
64+ If npm fails during an install when building a Docker Image with the `docker
65+ build` command, this log file will become inaccessible when Docker exits.
66+
67+ The Docker Working Group have chosen to be overly verbose during a build to
68+ provide an easy audit trail when install fails. If you prefer npm to be less
69+ verbose you can easily reset the verbosity of npm using the following
70+ techniques:
71+
72+ ### Dockerfile
73+
74+ If you create your own ` Dockerfile ` which inherits from the ` node ` image you can
75+ simply use ` ENV ` to override ` NPM_CONFIG_LOGLEVEL ` .
76+
77+ ```
78+ FROM node
79+ ENV NPM_CONFIG_LOGLEVEL warn
80+ ...
81+ ```
82+
83+ ### Docker Run
84+
85+ If you run the node image using ` docker run˙ you can use the ` -e` flag to
86+ override ` NPM_CONFIG_LOGLEVEL ` .
87+
88+ ```
89+ $ docker run -e NPM_CONFIG_LOGLEVEL=warn node ...
90+ ```
91+
92+ ### NPM run
93+
94+ If you are running npm commands you can use ` --loglevel ` to control the
95+ verbosity of the output.
96+
97+ ```
98+ $ docker run node npm --loglevel=warn ...
99+ ```
100+
56101# Image Variants
57102
58103The ` node ` images come in many flavors, each designed for a specific use case.
0 commit comments