docker_practice/appendix/repo/nodejs.md

41 lines
957 B
Go
Raw Normal View History

# [Node.js](https://hub.docker.com/_/node/)
2016-12-10 17:00:25 +08:00
##
2016-12-10 17:00:25 +08:00
2017-11-24 10:19:15 +08:00
[Node.js](https://en.wikipedia.org/wiki/Node.js) 是基于 JavaScript 的可扩展服务端和网络软件开发平台。
`https://hub.docker.com/_/node/` Node.js 0.10 ~ 14.x
2016-12-10 17:00:25 +08:00
## 使
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
Dockerfile
2017-11-22 11:13:23 +08:00
```bash
FROM node:12
2016-12-10 17:00:25 +08:00
# replace this with your application's default port
EXPOSE 8888
```
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
2017-11-22 11:13:23 +08:00
```bash
2016-12-10 17:00:25 +08:00
$ docker build -t my-nodejs-app
$ docker run -it --rm --name my-running-app my-nodejs-app
```
2017-11-22 11:13:23 +08:00
```bash
2017-12-01 17:32:39 +08:00
$ 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:12-alpine \
2017-12-01 17:32:39 +08:00
node your-daemon-or-script.js
2016-12-10 17:00:25 +08:00
```
## Dockerfile
2016-12-10 17:00:25 +08:00
2017-11-01 00:36:57 +08:00
https://github.com/docker-library/docs/tree/master/node 查看。