How to run docker on another server machine

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 implemented a docker and docker file on my local machine and then clicked on the docker hub.

On another machine, I pull the docker image from the dock and run the docar command, it succeeds and returns console.log ().

I want to see node module and project directory, but haven't seen it anywhere.

Please help me. How to show the project directory on another computer.

+3


source to share


1 answer


Your files are inside the container you created. You can execute a bash shell inside a container using docker exec -it container_name_or_id /bin/bash

. Then you will see your files in /app

.



+1


source







All Articles