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