fahidnasir/node-dockervolumes
This repository contains nodejs application which download files with http(s) and save inside of docker data-container.
Intro
This project will show a screen to upload files and save those files in Docker Volume or Local Folder (both feature have separate branches)
Why?
To show the power of node.js and demonstrate some file-system features.
Technologies/Packages
Package | Version | Description
Node.js | v7.6.0 | But it should work with all versions
express | v4+ | Light-Weight web framework for node.js
pug | v2+ View Engine
jquery | v3 client-side javascript library
bootstrap | v3 client-side design library
Docker Setup
Pre-Requities
- npm (Node Package Manager) by default ship with node.js Executable.
- Docker (Verify installation with command
docker -v) - Docker-Compose (Verify installation with command
docker-compose -v)
Steps to run docker data container sample
- Open Command Line
- Clone or Download Project (
git clone https://github.com/fahidnasir/node-dockervolumes.git) - Navigate inside folder (in this case
node-dockervolumes) - Switch to Branch
docker-container(git checkout docker-container) - run command
docker-compose buildto create docker image from existing code - run command
docker-compose upto start docker image - visit http://localhost:3000
- upload some files in browser
Note: Now you want to see the uploaded files inside the docker container
Want to see Uploaded Files in Docker?
While the application is still running in docker, do these steps
Steps
- run command
docker exec <docker container id/name> sh - Now you are inside docker container navigate to the folder with files
- run command
cd /var/lib/files/to navigate into the folder - run command
lsto list all the files in the folder
Local Setup
Pre-Requities
npm (Node Package Manager) by default ship with node.js Executable.
Steps to run local folder sample
- Open Command Line
- Clone or Download Project (
git clone https://github.com/fahidnasir/node-dockervolumes.git) - Navigate inside folder (in this case
node-dockervolumes) - run command
npm installto install the required packages - run command
npm startto start project - visit http://localhost:3000