I have code
server.js
'use strict';
const express = require('express');
// Constants
const PORT = 8080;
// App
const app = express();
app.get('/', function (req, res) {
res.send('Hello world\n');
});
app.listen(PORT);
console.log('Running on http://localhost:' + PORT);
dockerfile
FROM node:6.5.0
WORKDIR /app
RUN npm install nodemon -g
COPY package.json /app/package.json
RUN npm install
COPY server.js /app
EXPOSE 8080
package.json
{
"name": "docker_web_app",
"version": "1.0.0",
"description": "Node.js on Docker",
"author": "First Last <first.last@example.com>",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.13.3"
}
}
I have Implemented dockerfile and docker image on local machine and then pushed on docker hub.
On other machine I pull docker image from docker hub and run docar command, It runs successfully and return console.log().
I want to see node module and project directory, but have not seen anywhere.
Please help me. How can show project directory on other machine.
Your files are inside the container you have created. You can execute a bash shell inside the container using docker exec -it container_name_or_id /bin/bash. Then, you will see your files in /app.