Skip to content

Commit 613a812

Browse files
committed
docs: update npm loglevel description
1 parent 31a343b commit 613a812

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The official Node.js docker image, made with love by the node community.
1616
- [Create a `Dockerfile` in your Node.js app project](#create-a-dockerfile-in-your-nodejs-app-project)
1717
- [Best Practices](#best-practices)
1818
- [Run a single Node.js script](#run-a-single-nodejs-script)
19-
- [Verbosity](#verbosity)
19+
- [npm loglevel](#npm-loglevel)
2020
- [Dockerfile](#dockerfile)
2121
- [Docker Run](#docker-run)
2222
- [npm run](#npm-run)
@@ -111,41 +111,39 @@ Node.js Docker image directly:
111111
$ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/app -w /usr/src/app node:24 node your-daemon-or-script.js
112112
```
113113

114-
### Verbosity
114+
### npm loglevel
115115

116-
Prior to 8.7.0 and 6.11.4, the docker images overrode the default npm log
117-
level from `warn` to `info`. However, due to improvements to npm and new Docker
118-
patterns (e.g. multi-stage builds) the working group reached a [consensus](https://github.com/nodejs/docker-node/issues/528)
119-
to revert the log level to npm defaults. If you need more verbose output, please
120-
use one of the following methods to change the verbosity level.
116+
The default [npm loglevel](https://docs.npmjs.com/cli/using-npm/logging)
117+
is `notice`, which includes also the levels `warn` and `error`.
118+
If you need to set a different `loglevel` for npm, follow these example instructions:
121119

122120
#### Dockerfile
123121

124122
If you create your own `Dockerfile` which inherits from the `node` image, you can
125-
simply use `ENV` to override `NPM_CONFIG_LOGLEVEL`.
123+
use `ENV` to set the `NPM_CONFIG_LOGLEVEL` environment variable.
126124

127125
```dockerfile
128-
FROM node
126+
FROM node:lts
129127
ENV NPM_CONFIG_LOGLEVEL=info
130128
...
131129
```
132130

133131
#### Docker Run
134132

135133
If you run the node image using `docker run`, you can use the `-e` flag to
136-
override `NPM_CONFIG_LOGLEVEL`.
134+
set the `NPM_CONFIG_LOGLEVEL` environment variable.
137135

138136
```console
139-
$ docker run -e NPM_CONFIG_LOGLEVEL=info node ...
137+
$ docker run -e NPM_CONFIG_LOGLEVEL=info node:lts ...
140138
```
141139

142140
#### npm run
143141

144-
If you are running npm commands, you can use `--loglevel` to control the
145-
verbosity of the output.
142+
If you are running npm commands, you can use the `--loglevel` command line flag
143+
to control the verbosity of the output.
146144

147145
```console
148-
$ docker run node npm --loglevel=warn ...
146+
$ docker run node:lts npm --loglevel=info ...
149147
```
150148

151149
## Image Variants

0 commit comments

Comments
 (0)