File tree 1 file changed +39
-0
lines changed
1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,45 @@ $ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/app -w
53
53
/usr/src/app node:4 node your-daemon-or-script.js
54
54
```
55
55
56
+ ## Verbosity
57
+
58
+ By default Node.js Docker Image has NPM log verbosity set to ` info ` instead of
59
+ the default ` warn ` . This is because of the way Docker is isolated from the host
60
+ operating system and you are not guaranteed to be able to retrieve the
61
+ ` npm-debug.log ` file when something breaks.
62
+
63
+ There are some scenarios where this creates too much output and you can reset
64
+ the verbosity of npm using the following techniques:
65
+
66
+ ### Dockerfile
67
+
68
+ If you create your own ` Dockerfile ` which inherits from the ` node ` image you can
69
+ simply use ` ENV ` to override ` NPM_CONFIG_LOGLEVEL ` .
70
+
71
+ ```
72
+ FROM node
73
+ ENV NPM_CONFIG_LOGLEVEL warn
74
+ ...
75
+ ```
76
+
77
+ ### Docker Run
78
+
79
+ If you run the node image using ` docker run˙ you can use the ` -e` flag to
80
+ override ` NPM_CONFIG_LOGLEVEL ` .
81
+
82
+ ```
83
+ $ docker run -e NPM_CONFIG_LOGLEVEL=warn node ...
84
+ ```
85
+
86
+ ### NPM run
87
+
88
+ If you are running npm commands you can use ` --loglevel ` to control the
89
+ verbosity of the output.
90
+
91
+ ```
92
+ $ docker run node npm --loglevel=warn ...
93
+ ```
94
+
56
95
# Image Variants
57
96
58
97
The ` node ` images come in many flavors, each designed for a specific use case.
You can’t perform that action at this time.
0 commit comments