Skip to content

An example of how to run node.js code stored on external volume on node base image

Notifications You must be signed in to change notification settings

atton16/node-docker-volume

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-docker-volume

An example of how to run node.js code stored on external volume on node base image

Steps

Download the base image

docker pull node:12-alpine

Build the code

docker build -t node-docker-volume:1.0.0 .

Copy the code to external volume

docker volume create node-docker-volume_1.0.0
docker run --rm \
 -v node-docker-volume_1.0.0:/usr/src/app \
 --entrypoint=/bin/cp \
 node-docker-volume:1.0.0 \
 -L -r -a /usr/src/build/. /usr/src/app/

Run the code on base image with the external volume

docker run --rm \
 --expose 3000 \
 -p 3000:3000 \
 -v node-docker-volume_1.0.0:/usr/src/app \
 -w /usr/src/app \
 node:12-alpine \
 index.js

Cleanup

docker rmi node-docker-volume:1.0.0

Remark

Image Content Inspection

docker run --rm -it --entrypoint /bin/sh node-docker-volume:1.0.0

Volume Content Inspection

docker run \
 --rm \
 -v node-docker-volume_1.0.0:/usr/src/app \
 --entrypoint=/bin/ls \
 node:12-alpine /usr/src/app -l -a

Volume Size Inspection

docker system df -v | grep node-docker-volume_1.0.0

About

An example of how to run node.js code stored on external volume on node base image

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published