Skip to content

Commit ad40208

Browse files
committed
Update node/content.md
1 parent 78753a6 commit ad40208

File tree

3 files changed

+76
-223
lines changed

3 files changed

+76
-223
lines changed

node/README.md

Lines changed: 11 additions & 220 deletions
Original file line numberDiff line numberDiff line change
@@ -4,252 +4,43 @@
44
55
WARNING:
66
7-
DO NOT EDIT "node/README.md"
7+
DO NOT EDIT "%%REPO%%/README.md"
88
99
IT IS AUTO-GENERATED
1010
11-
(from the other files in "node/" combined with a set of templates)
11+
(from the other files in "%%REPO%%/" combined with a set of templates)
1212
1313
********************************************************************************
1414
1515
-->
1616

1717
# Supported tags and respective `Dockerfile` links
1818

19-
- [`8.1.4`, `8.1`, `8`, `latest` (*8.1/Dockerfile*)](https://github.com/nodejs/docker-node/blob/a5e2d0fab5b14773e0fdc460c0b96d0f93a80ba2/8.1/Dockerfile)
20-
- [`8.1.4-alpine`, `8.1-alpine`, `8-alpine`, `alpine` (*8.1/alpine/Dockerfile*)](https://github.com/nodejs/docker-node/blob/a5e2d0fab5b14773e0fdc460c0b96d0f93a80ba2/8.1/alpine/Dockerfile)
21-
- [`8.1.4-onbuild`, `8.1-onbuild`, `8-onbuild`, `onbuild` (*8.1/onbuild/Dockerfile*)](https://github.com/nodejs/docker-node/blob/a5e2d0fab5b14773e0fdc460c0b96d0f93a80ba2/8.1/onbuild/Dockerfile)
22-
- [`8.1.4-slim`, `8.1-slim`, `8-slim`, `slim` (*8.1/slim/Dockerfile*)](https://github.com/nodejs/docker-node/blob/a5e2d0fab5b14773e0fdc460c0b96d0f93a80ba2/8.1/slim/Dockerfile)
23-
- [`8.1.4-wheezy`, `8.1-wheezy`, `8-wheezy`, `wheezy` (*8.1/wheezy/Dockerfile*)](https://github.com/nodejs/docker-node/blob/a5e2d0fab5b14773e0fdc460c0b96d0f93a80ba2/8.1/wheezy/Dockerfile)
24-
- [`7.10.1`, `7.10`, `7` (*7.10/Dockerfile*)](https://github.com/nodejs/docker-node/blob/0aadad9c44ff26afc81469d77df9b948be47c312/7.10/Dockerfile)
25-
- [`7.10.1-alpine`, `7.10-alpine`, `7-alpine` (*7.10/alpine/Dockerfile*)](https://github.com/nodejs/docker-node/blob/0aadad9c44ff26afc81469d77df9b948be47c312/7.10/alpine/Dockerfile)
26-
- [`7.10.1-onbuild`, `7.10-onbuild`, `7-onbuild` (*7.10/onbuild/Dockerfile*)](https://github.com/nodejs/docker-node/blob/0fcdf0b2660e73ab1054f932f4beac5b3946fb21/7.10/onbuild/Dockerfile)
27-
- [`7.10.1-slim`, `7.10-slim`, `7-slim` (*7.10/slim/Dockerfile*)](https://github.com/nodejs/docker-node/blob/0aadad9c44ff26afc81469d77df9b948be47c312/7.10/slim/Dockerfile)
28-
- [`7.10.1-wheezy`, `7.10-wheezy`, `7-wheezy` (*7.10/wheezy/Dockerfile*)](https://github.com/nodejs/docker-node/blob/0aadad9c44ff26afc81469d77df9b948be47c312/7.10/wheezy/Dockerfile)
29-
- [`6.11.1`, `6.11`, `6`, `boron` (*6.11/Dockerfile*)](https://github.com/nodejs/docker-node/blob/bb200caf20280e436dedc56a5f194fd21e684758/6.11/Dockerfile)
30-
- [`6.11.1-alpine`, `6.11-alpine`, `6-alpine`, `boron-alpine` (*6.11/alpine/Dockerfile*)](https://github.com/nodejs/docker-node/blob/bb200caf20280e436dedc56a5f194fd21e684758/6.11/alpine/Dockerfile)
31-
- [`6.11.1-onbuild`, `6.11-onbuild`, `6-onbuild`, `boron-onbuild` (*6.11/onbuild/Dockerfile*)](https://github.com/nodejs/docker-node/blob/bb200caf20280e436dedc56a5f194fd21e684758/6.11/onbuild/Dockerfile)
32-
- [`6.11.1-slim`, `6.11-slim`, `6-slim`, `boron-slim` (*6.11/slim/Dockerfile*)](https://github.com/nodejs/docker-node/blob/bb200caf20280e436dedc56a5f194fd21e684758/6.11/slim/Dockerfile)
33-
- [`6.11.1-wheezy`, `6.11-wheezy`, `6-wheezy`, `boron-wheezy` (*6.11/wheezy/Dockerfile*)](https://github.com/nodejs/docker-node/blob/bb200caf20280e436dedc56a5f194fd21e684758/6.11/wheezy/Dockerfile)
34-
- [`4.8.4`, `4.8`, `4`, `argon` (*4.8/Dockerfile*)](https://github.com/nodejs/docker-node/blob/3ffba881ad5a78d33b8edf888d5406222b60686e/4.8/Dockerfile)
35-
- [`4.8.4-alpine`, `4.8-alpine`, `4-alpine`, `argon-alpine` (*4.8/alpine/Dockerfile*)](https://github.com/nodejs/docker-node/blob/3ffba881ad5a78d33b8edf888d5406222b60686e/4.8/alpine/Dockerfile)
36-
- [`4.8.4-onbuild`, `4.8-onbuild`, `4-onbuild`, `argon-onbuild` (*4.8/onbuild/Dockerfile*)](https://github.com/nodejs/docker-node/blob/3ffba881ad5a78d33b8edf888d5406222b60686e/4.8/onbuild/Dockerfile)
37-
- [`4.8.4-slim`, `4.8-slim`, `4-slim`, `argon-slim` (*4.8/slim/Dockerfile*)](https://github.com/nodejs/docker-node/blob/3ffba881ad5a78d33b8edf888d5406222b60686e/4.8/slim/Dockerfile)
38-
- [`4.8.4-wheezy`, `4.8-wheezy`, `4-wheezy`, `argon-wheezy` (*4.8/wheezy/Dockerfile*)](https://github.com/nodejs/docker-node/blob/3ffba881ad5a78d33b8edf888d5406222b60686e/4.8/wheezy/Dockerfile)
19+
%%TAGS%%
3920

4021
# Quick reference
4122

4223
- **Where to get help**:
43-
[the Docker Community Forums](https://forums.docker.com/), [the Docker Community Slack](https://blog.docker.com/2016/11/introducing-docker-community-directory-docker-community-slack/), or [Stack Overflow](https://stackoverflow.com/search?tab=newest&q=docker)
24+
%%GET-HELP%%
4425

4526
- **Where to file issues**:
46-
[https://github.com/nodejs/docker-node/issues](https://github.com/nodejs/docker-node/issues)
27+
%%ISSUES%%
4728

4829
- **Maintained by**:
49-
[The Node.js Docker Team](https://github.com/nodejs/docker-node)
30+
%%MAINTAINER%%
5031

5132
- **Published image artifact details**:
52-
[repo-info repo's `repos/node/` directory](https://github.com/docker-library/repo-info/blob/master/repos/node) ([history](https://github.com/docker-library/repo-info/commits/master/repos/node))
33+
[repo-info repo's `repos/%%REPO%%/` directory](https://github.com/docker-library/repo-info/blob/master/repos/%%REPO%%) ([history](https://github.com/docker-library/repo-info/commits/master/repos/%%REPO%%))
5334
(image metadata, transfer size, etc)
5435

5536
- **Image updates**:
56-
[official-images PRs with label `library/node`](https://github.com/docker-library/official-images/pulls?q=label%3Alibrary%2Fnode)
57-
[official-images repo's `library/node` file](https://github.com/docker-library/official-images/blob/master/library/node) ([history](https://github.com/docker-library/official-images/commits/master/library/node))
37+
[official-images PRs with label `library/%%REPO%%`](https://github.com/docker-library/official-images/pulls?q=label%3Alibrary%2F%%REPO%%)
38+
[official-images repo's `library/%%REPO%%` file](https://github.com/docker-library/official-images/blob/master/library/%%REPO%%) ([history](https://github.com/docker-library/official-images/commits/master/library/%%REPO%%))
5839

5940
- **Source of this description**:
60-
[docs repo's `node/` directory](https://github.com/docker-library/docs/tree/master/node) ([history](https://github.com/docker-library/docs/commits/master/node))
41+
[docs repo's `%%REPO%%/` directory](https://github.com/docker-library/docs/tree/master/%%REPO%%) ([history](https://github.com/docker-library/docs/commits/master/%%REPO%%))
6142

6243
- **Supported Docker versions**:
6344
[the latest release](https://github.com/docker/docker/releases/latest) (down to 1.6 on a best-effort basis)
6445

65-
# What is Node.js?
66-
67-
Node.js is a software platform for scalable server-side and networking applications. Node.js applications are written in JavaScript and can be run within the Node.js runtime on Mac OS X, Windows, and Linux without changes.
68-
69-
Node.js applications are designed to maximize throughput and efficiency, using non-blocking I/O and asynchronous events. Node.js applications run single-threaded, although Node.js uses multiple threads for file and network events. Node.js is commonly used for real-time applications due to its asynchronous nature.
70-
71-
Node.js internally uses the Google V8 JavaScript engine to execute code; a large percentage of the basic modules are written in JavaScript. Node.js contains a built-in, asynchronous I/O library for file, socket, and HTTP communication. The HTTP and socket support allows Node.js to act as a web server without additional software such as Apache.
72-
73-
> [wikipedia.org/wiki/Node.js](https://en.wikipedia.org/wiki/Node.js)
74-
75-
![logo](https://github.com/raw/docker-library/docs/01c12653951b2fe592c1f93a13b4e289ada0e3a1/node/logo.png)
76-
77-
# How to use this image
78-
79-
## Create a `Dockerfile` in your Node.js app project
80-
81-
```dockerfile
82-
FROM node:4-onbuild
83-
# replace this with your application's default port
84-
EXPOSE 8888
85-
```
86-
87-
You can then build and run the Docker image:
88-
89-
```console
90-
$ docker build -t my-nodejs-app .
91-
$ docker run -it --rm --name my-running-app my-nodejs-app
92-
```
93-
94-
### Notes
95-
96-
The image assumes that your application has a file named
97-
[`package.json`](https://docs.npmjs.com/files/package.json) listing its
98-
dependencies and defining its [start
99-
script](https://docs.npmjs.com/misc/scripts#default-values).
100-
101-
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:
102-
103-
```
104-
node_modules
105-
```
106-
107-
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.
108-
109-
## Run a single Node.js script
110-
111-
For many simple, single file projects, you may find it inconvenient to write a
112-
complete `Dockerfile`. In such cases, you can run a Node.js script by using the
113-
Node.js Docker image directly:
114-
115-
```console
116-
$ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/app -w /usr/src/app node:4 node your-daemon-or-script.js
117-
```
118-
119-
## Verbosity
120-
121-
By default the Node.js Docker Image has npm log verbosity set to `info` instead
122-
of the default `warn`. This is because of the way Docker is isolated from the
123-
host operating system and you are not guaranteed to be able to retrieve the
124-
`npm-debug.log` file when npm fails.
125-
126-
When npm fails, it writes it's verbose log to a log file inside the container.
127-
If npm fails during an install when building a Docker Image with the `docker
128-
build` command, this log file will become inaccessible when Docker exits.
129-
130-
The Docker Working Group have chosen to be overly verbose during a build to
131-
provide an easy audit trail when install fails. If you prefer npm to be less
132-
verbose you can easily reset the verbosity of npm using the following
133-
techniques:
134-
135-
### Dockerfile
136-
137-
If you create your own `Dockerfile` which inherits from the `node` image you can
138-
simply use `ENV` to override `NPM_CONFIG_LOGLEVEL`.
139-
140-
```
141-
FROM node
142-
ENV NPM_CONFIG_LOGLEVEL warn
143-
...
144-
```
145-
146-
### Docker Run
147-
148-
If you run the node image using `docker run` you can use the `-e` flag to
149-
override `NPM_CONFIG_LOGLEVEL`.
150-
151-
```
152-
$ docker run -e NPM_CONFIG_LOGLEVEL=warn node ...
153-
```
154-
155-
### NPM run
156-
157-
If you are running npm commands you can use `--loglevel` to control the
158-
verbosity of the output.
159-
160-
```
161-
$ docker run node npm --loglevel=warn ...
162-
```
163-
164-
# Image Variants
165-
166-
The `node` images come in many flavors, each designed for a specific use case.
167-
All of the images contain pre-installed versions of `node`,
168-
[`npm`](https://www.npmjs.com/), and [`yarn`](https://yarnpkg.com).
169-
170-
## `node:<version>`
171-
172-
This is the defacto image. If you are unsure about what your needs are, you
173-
probably want to use this one. It is designed to be used both as a throw away
174-
container (mount your source code and start the container to start your app), as
175-
well as the base to build other images off of. This tag is based off of
176-
[`buildpack-deps`](https://registry.hub.docker.com/_/buildpack-deps/).
177-
`buildpack-deps` is designed for the average user of docker who has many images
178-
on their system. It, by design, has a large number of extremely common Debian
179-
packages. This reduces the number of packages that images that derive from it
180-
need to install, thus reducing the overall size of all images on your system.
181-
182-
## `node:alpine`
183-
184-
This image is based on the popular
185-
[Alpine Linux project](http://alpinelinux.org), available in
186-
[the `alpine` official image](https://hub.docker.com/_/alpine). Alpine Linux is
187-
much smaller than most distribution base images (~5MB), and thus leads to much
188-
slimmer images in general.
189-
190-
This variant is highly recommended when final image size being as small as
191-
possible is desired. The main caveat to note is that it does use
192-
[musl libc](http://www.musl-libc.org) instead of
193-
[glibc and friends](http://www.etalabs.net/compare_libcs.html), so certain
194-
software might run into issues depending on the depth of their libc
195-
requirements. However, most software doesn't have an issue with this, so this
196-
variant is usually a very safe choice. See
197-
[this Hacker News comment thread](https://news.ycombinator.com/item?id=10782897)
198-
for more discussion of the issues that might arise and some pro/con comparisons
199-
of using Alpine-based images.
200-
201-
To minimize image size, it's uncommon for additional related tools
202-
(such as `git` or `bash`) to be included in Alpine-based images. Using this
203-
image as a base, add the things you need in your own Dockerfile
204-
(see the [`alpine` image description](https://hub.docker.com/_/alpine/) for
205-
examples of how to install packages if you are unfamiliar).
206-
207-
208-
## `node:onbuild`
209-
210-
The `ONBUILD` image variants are deprecated, and their usage is discouraged. For more details, see [docker-library/official-images#2076](https://github.com/docker-library/official-images/issues/2076).
211-
212-
This image makes building derivative images easier. For most use cases, creating
213-
a `Dockerfile` in the base of your project directory with the line `FROM
214-
node:onbuild` will be enough to create a stand-alone image for your project.
215-
216-
While the `onbuild` variant is really useful for "getting off the ground
217-
running" (zero to Dockerized in a short period of time), it's not recommended
218-
for long-term usage within a project due to the lack of control over *when* the
219-
`ONBUILD` triggers fire (see also
220-
[`docker/docker#5714`](https://github.com/docker/docker/issues/5714),
221-
[`docker/docker#8240`](https://github.com/docker/docker/issues/8240),
222-
[`docker/docker#11917`](https://github.com/docker/docker/issues/11917)).
223-
224-
Once you've got a handle on how your project functions within Docker, you'll
225-
probably want to adjust your `Dockerfile` to inherit from a non-`onbuild`
226-
variant and copy the commands from the `onbuild` variant `Dockerfile` (moving
227-
the `ONBUILD` lines to the end and removing the `ONBUILD` keywords) into your
228-
own file so that you have tighter control over them and more transparency for
229-
yourself and others looking at your `Dockerfile` as to what it does. This also
230-
makes it easier to add additional requirements as time goes on (such as
231-
installing more packages before performing the previously-`ONBUILD` steps).
232-
233-
This `onbuild` variant will only install npm packages according to the
234-
`package.json` and *does not* adhere to the `npm-shrinkwrap.json` (see full
235-
discussion in
236-
[`nodejs/docker-node#65`](https://github.com/nodejs/docker-node/issues/65).
237-
238-
Note that npm installs devDependencies by default, which is undesirable if
239-
you're building a production image. To avoid this pass NODE_ENV as a build
240-
argument i.e. `docker build --build-arg NODE_ENV=production …`.
241-
242-
## `node:slim`
243-
244-
This image does not contain the common packages contained in the default tag and
245-
only contains the minimal packages needed to run `node`. Unless you are working
246-
in an environment where *only* the Node.js image will be deployed and you have
247-
space constraints, we highly recommend using the default image of this
248-
repository.
249-
250-
# License
251-
252-
[License information](https://github.com/nodejs/node/blob/master/LICENSE) for
253-
the software contained in this image. [License
254-
information](https://github.com/nodejs/docker-node/blob/master/LICENSE) for the
255-
Node.js Docker project.
46+
%%CONTENT%%%%VARIANT%%%%LICENSE%%

node/content.md

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,71 @@ $ docker run -it --rm --name my-running-app my-nodejs-app
2929

3030
### Notes
3131

32-
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).
32+
The image assumes that your application has a file named
33+
[`package.json`](https://docs.npmjs.com/files/package.json) listing its
34+
dependencies and defining its [start
35+
script](https://docs.npmjs.com/misc/scripts#default-values).
36+
37+
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+
39+
```
40+
node_modules
41+
```
42+
43+
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.
3344

3445
## Run a single Node.js script
3546

36-
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:
47+
For many simple, single file projects, you may find it inconvenient to write a
48+
complete `Dockerfile`. In such cases, you can run a Node.js script by using the
49+
Node.js Docker image directly:
3750

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

node/license.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
View [license information](https://github.com/joyent/node/blob/master/LICENSE) for the software contained in this image.
1+
[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.

0 commit comments

Comments
 (0)