The codjix/aio:node image provides a lightweight Node.js runtime environment built on Alpine Linux. This image is optimized for running JavaScript and TypeScript applications.
node with ID 1000 for better security# Start a Node.js REPL
docker run -it --name aio-node codjix/aio:node
# Run a Node.js script
docker run -it --name aio-node -v $(pwd):/app -w /app codjix/aio:node node index.js
docker run -d --name aio-node-app -v $(pwd):/app -w /app -p 3000:3000 codjix/aio:node node server.js
# Install dependencies
docker run -it -v $(pwd):/app -w /app codjix/aio:node npm install
# Run npm scripts
docker run -it -v $(pwd):/app -w /app codjix/aio:node npm run start
Mount your application code to any directory, commonly /app:
docker run -it -v $(pwd):/app -w /app codjix/aio:node
version: '3'
services:
node-app:
image: codjix/aio:node
container_name: aio-node-app
ports:
- "3000:3000"
volumes:
- ./app:/app
working_dir: /app
command: node server.js
environment:
- NODE_ENV=production
restart: unless-stopped
version: '3'
services:
node-dev:
image: codjix/aio:node
container_name: aio-node-dev
ports:
- "3000:3000"
volumes:
- ./app:/app
working_dir: /app
command: npm run dev
environment:
- NODE_ENV=development
The Dockerfile and associated scripts for this image are available in the src/node directory of the AIO repository.