Skip to content

Commit 31203ab

Browse files
author
Hans Kristian Flaatten
committed
Explain the npm verbosity in the node image
Close: #57 Related: nodejs/docker-iojs#36 Signed-off-by: Hans Kristian Flaatten <[email protected]>
1 parent e72adcf commit 31203ab

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

+39
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,45 @@ $ 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 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+
5695
# Image Variants
5796

5897
The `node` images come in many flavors, each designed for a specific use case.

0 commit comments

Comments
 (0)