docker_practice/appendix/repo/nodejs.md

41 lines
959 B
Go
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

## [Node.js](https://hub.docker.com/_/node/)
###
[Node.js](https://en.wikipedia.org/wiki/Node.js) 是基于 JavaScript 的可扩展服务端和网络软件开发平台。
`https://hub.docker.com/_/node/` Node.js 0.10 ~ 11.x
### 使
Dockerfile
```bash
FROM node:9
# replace this with your application's default port
EXPOSE 8888
```
```bash
$ docker build -t my-nodejs-app
$ docker run -it --rm --name my-running-app my-nodejs-app
```
```bash
$ docker run -it --rm \
--name my-running-script \
# -v "$(pwd)":/usr/src/myapp \
--mount type=bind,src=`$(pwd)`,target=/usr/src/myapp \
-w /usr/src/myapp \
node:9-alpine \
node your-daemon-or-script.js
```
### Dockerfile
https://github.com/docker-library/docs/tree/master/node 查看。