Merge pull request #2056 from grjan7/main

docs: added punctuation
This commit is contained in:
Simen Bekkhus 2024-04-05 08:08:52 +02:00 committed by GitHub
commit ba5213b4d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 12 deletions

View File

@ -111,15 +111,15 @@ $ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/app -w /usr/sr
### Verbosity ### Verbosity
Prior to 8.7.0 and 6.11.4 the docker images overrode the default npm log Prior to 8.7.0 and 6.11.4, the docker images overrode the default npm log
level from `warn` to `info`. However due to improvements to npm and new Docker level from `warn` to `info`. However, due to improvements to npm and new Docker
patterns (e.g. multi-stage builds) the working group reached a [consensus](https://github.com/nodejs/docker-node/issues/528) patterns (e.g. multi-stage builds) the working group reached a [consensus](https://github.com/nodejs/docker-node/issues/528)
to revert the log level to npm defaults. If you need more verbose output, please to revert the log level to npm defaults. If you need more verbose output, please
use one of the following methods to change the verbosity level. use one of the following methods to change the verbosity level.
#### Dockerfile #### Dockerfile
If you create your own `Dockerfile` which inherits from the `node` image you can If you create your own `Dockerfile` which inherits from the `node` image, you can
simply use `ENV` to override `NPM_CONFIG_LOGLEVEL`. simply use `ENV` to override `NPM_CONFIG_LOGLEVEL`.
```dockerfile ```dockerfile
@ -130,7 +130,7 @@ ENV NPM_CONFIG_LOGLEVEL info
#### Docker Run #### Docker Run
If you run the node image using `docker run` you can use the `-e` flag to If you run the node image using `docker run`, you can use the `-e` flag to
override `NPM_CONFIG_LOGLEVEL`. override `NPM_CONFIG_LOGLEVEL`.
```console ```console
@ -139,7 +139,7 @@ $ docker run -e NPM_CONFIG_LOGLEVEL=info node ...
#### NPM run #### NPM run
If you are running npm commands you can use `--loglevel` to control the If you are running npm commands, you can use `--loglevel` to control the
verbosity of the output. verbosity of the output.
```console ```console

View File

@ -44,7 +44,7 @@ ENV PATH=$PATH:/home/node/.npm-global/bin # optionally if you want to run npm gl
If you need to upgrade/downgrade `yarn` for a local install, you can do so by issuing the following commands in your `Dockerfile`: If you need to upgrade/downgrade `yarn` for a local install, you can do so by issuing the following commands in your `Dockerfile`:
> Note that if you create some other directory which is not a descendant one from where you ran the command, you will end up using the global (dated) version. If you wish to upgrade `yarn` globally follow the instructions in the next section. > Note that if you create some other directory which is not a descendant one from where you ran the command, you will end up using the global (dated) version. If you wish to upgrade `yarn` globally, follow the instructions in the next section.
> When following the local install instructions, due to duplicated yarn the image will end up being bigger. > When following the local install instructions, due to duplicated yarn the image will end up being bigger.
@ -115,7 +115,7 @@ USER node
Note that the `node` user is neither a build-time nor a run-time dependency and it can be removed or altered, as long as the functionality of the application you want to add to the container does not depend on it. Note that the `node` user is neither a build-time nor a run-time dependency and it can be removed or altered, as long as the functionality of the application you want to add to the container does not depend on it.
If you do not want nor need the user created in this image you can remove it with the following: If you do not want nor need the user created in this image, you can remove it with the following:
```Dockerfile ```Dockerfile
# For debian based images use: # For debian based images use:
@ -125,13 +125,13 @@ RUN userdel -r node
RUN deluser --remove-home node RUN deluser --remove-home node
``` ```
If you need to change the uid/gid of the user you can use: If you need to change the uid/gid of the user, you can use:
```Dockerfile ```Dockerfile
RUN groupmod -g 999 node && usermod -u 999 -g 999 node RUN groupmod -g 999 node && usermod -u 999 -g 999 node
``` ```
If you need another name for the user (ex. `myapp`) execute: If you need another name for the user (ex. `myapp`), execute:
```Dockerfile ```Dockerfile
RUN usermod -d /home/myapp -l myapp node RUN usermod -d /home/myapp -l myapp node
@ -147,7 +147,7 @@ RUN deluser --remove-home node \
## Memory ## Memory
By default, any Docker Container may consume as much of the hardware such as CPU and RAM. If you are running multiple containers on the same host you should limit how much memory they can consume. By default, any Docker Container may consume as much of the hardware such as CPU and RAM. If you are running multiple containers on the same host, you should limit how much memory they can consume.
``` ```
-m "300M" --memory-swap "1G" -m "300M" --memory-swap "1G"
@ -155,7 +155,7 @@ By default, any Docker Container may consume as much of the hardware such as CPU
## CMD ## CMD
When creating an image, you can bypass the `package.json`'s `start` command and bake it directly into the image itself. First off this reduces the number of processes running inside of your container. Secondly it causes exit signals such as `SIGTERM` and `SIGINT` to be received by the Node.js process instead of npm swallowing them. When creating an image, you can bypass the `package.json`'s `start` command and bake it directly into the image itself. First off, this reduces the number of processes running inside of your container. Secondly, it causes exit signals such as `SIGTERM` and `SIGINT` to be received by the Node.js process instead of npm swallowing them.
```Dockerfile ```Dockerfile
CMD ["node","index.js"] CMD ["node","index.js"]
@ -192,7 +192,7 @@ RUN apk add --no-cache --virtual .gyp python3 make g++ \
&& apk del .gyp && apk del .gyp
``` ```
And Here's a multistage build example And, here's a multistage build example:
```Dockerfile ```Dockerfile
FROM node:alpine as builder FROM node:alpine as builder