You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The image assumes that your application has a file named [`package.json`](https://docs.npmjs.com/files/package.json) listing its dependencies and defining its [start script](https://docs.npmjs.com/misc/scripts#default-values).
36
33
37
34
It also assumes that you have a file named [`.dockerignore`](https://docs.docker.com/engine/reference/builder/#/dockerignore-file) otherwise it will copy your local npm modules:
38
35
39
-
```
40
-
node_modules
41
-
```
36
+
node_modules
42
37
43
38
We have assembled a [Best Practices Guide](https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md) for those using these images on a daily basis.
44
39
45
-
All of the images contain pre-installed versions of `node`,
46
-
[`npm`](https://www.npmjs.com/), and [`yarn`](https://yarnpkg.com). For each
47
-
supported architecture, the supported variants are different. In the file
it lists all supported variants for all of the architectures that we support now.
40
+
All of the images contain pre-installed versions of `node`, [`npm`](https://www.npmjs.com/), and [`yarn`](https://yarnpkg.com). For each supported architecture, the supported variants are different. In the file [architectures](https://github.com/nodejs/docker-node/blob/master/architectures), it lists all supported variants for all of the architectures that we support now.
50
41
51
42
## Run a single Node.js script
52
43
53
-
For many simple, single file projects, you may find it inconvenient to write a
54
-
complete `Dockerfile`. In such cases, you can run a Node.js script by using the
55
-
Node.js Docker image directly:
44
+
For many simple, single file projects, you may find it inconvenient to write a complete `Dockerfile`. In such cases, you can run a Node.js script by using the Node.js Docker image directly:
By default the Node.js Docker Image has npm log verbosity set to `info` instead
64
-
of the default `warn`. This is because of the way Docker is isolated from the
65
-
host operating system and you are not guaranteed to be able to retrieve the
66
-
`npm-debug.log` file when npm fails.
52
+
By default the Node.js Docker Image has npm log verbosity set to `info` instead of the default `warn`. This is because of the way Docker is isolated from the host operating system and you are not guaranteed to be able to retrieve the `npm-debug.log` file when npm fails.
67
53
68
-
When npm fails, it writes it's verbose log to a log file inside the container.
69
-
If npm fails during an install when building a Docker Image with the `docker
70
-
build` command, this log file will become inaccessible when Docker exits.
54
+
When npm fails, it writes it's verbose log to a log file inside the container. If npm fails during an install when building a Docker Image with the `docker build` command, this log file will become inaccessible when Docker exits.
71
55
72
-
The Docker Working Group have chosen to be overly verbose during a build to
73
-
provide an easy audit trail when install fails. If you prefer npm to be less
74
-
verbose you can easily reset the verbosity of npm using the following
75
-
techniques:
56
+
The Docker Working Group have chosen to be overly verbose during a build to provide an easy audit trail when install fails. If you prefer npm to be less verbose you can easily reset the verbosity of npm using the following techniques:
76
57
77
58
### Dockerfile
78
59
79
-
If you create your own `Dockerfile` which inherits from the `node` image you can
80
-
simply use `ENV` to override `NPM_CONFIG_LOGLEVEL`.
60
+
If you create your own `Dockerfile` which inherits from the `node` image you can simply use `ENV` to override `NPM_CONFIG_LOGLEVEL`.
81
61
82
-
```
83
-
FROM node
84
-
ENV NPM_CONFIG_LOGLEVEL warn
85
-
...
86
-
```
62
+
FROM node
63
+
ENV NPM_CONFIG_LOGLEVEL warn
64
+
...
87
65
88
66
### Docker Run
89
67
90
-
If you run the node image using `docker run` you can use the `-e` flag to
91
-
override `NPM_CONFIG_LOGLEVEL`.
68
+
If you run the node image using `docker run` you can use the `-e` flag to override `NPM_CONFIG_LOGLEVEL`.
92
69
93
-
```
94
-
$ docker run -e NPM_CONFIG_LOGLEVEL=warn node ...
95
-
```
70
+
$ docker run -e NPM_CONFIG_LOGLEVEL=warn node ...
96
71
97
72
### NPM run
98
73
99
-
If you are running npm commands you can use `--loglevel` to control the
100
-
verbosity of the output.
74
+
If you are running npm commands you can use `--loglevel` to control the verbosity of the output.
[License information](https://github.com/nodejs/node/blob/master/LICENSE) for
2
-
the software contained in this image. [License
3
-
information](https://github.com/nodejs/docker-node/blob/master/LICENSE) for the
4
-
Node.js Docker project.
1
+
View [license information](https://github.com/nodejs/node/blob/master/LICENSE) for Node.js or [license information](https://github.com/nodejs/docker-node/blob/master/LICENSE) for the Node.js Docker project.
0 commit comments