Docker Image for Running NodeJS Applications
455
This Docker image provides an easy way to run your NodeJS applications in a container. It comes pre-installed with all the required software, libraries and tools, including Ubuntu, NodeJS, tini, and npm. The exposed ports are 3000, 4200, 80 and 443, and the offered volume is /apt.
node:19.6.0-buster-slim and ported to ubuntu:jammy-20230126node:9-stretch/aptdocker image pull asaramet/npm-run
80), and mount your local folder to the container using the -v option.For example, to mount the current working directory:
docker container run --rm -p 80:80 -v $(pwd):/app asaramet/npm-run
Or, to mount the local folder /path/to/local/folder to the container's /app directory:
docker container run --rm -p 4200:4200 -p 80:80 -p 443:443 -v /path/to/local/folder:/app asaramet/npm-run
# Get the container ID
docker container ls -a
# Start the container interactively
docker container exec -it <CONTAINER_ID> bash
# Run other commands from your 'package.json', for example 'compile' command:
npm run compile
npm install and npm start upon launch. You can add this command to your docker-compose.yml file for easy configuration. Here is an example:node_server:
image: asaramet/npm-run
ports:
- "3000:3000"
- "443:443"
- "80:80"
volumes:
- ./node-server:/app
command: npm install && npm cache clean --force && npm start
Content type
Image
Digest
sha256:3ff40613b…
Size
96.1 MB
Last updated
over 3 years ago
docker pull asaramet/npm-run