Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

294
Views
Getting "Cannot get/" when using a node image with docker and express

After a lot of tries I finally managed to get docker on my computer. So I have an app1 directory with the following files:

Dockerfile:

FROM node:latest
EXPOSE 8080

WORKDIR /app

COPY package-lock.json  .
COPY package.json .

RUN npm install

CMD ["npm", "start"]

package.json:

{
  "name": "app1",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "scripts": {
    "start": "node src/server.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1"
  }
}

Then a src directory with server.js:

'use strict';


// load package
const express = require('express');


const PORT = 8080;
const HOST = '0.0.0.0';
const app = express();
 
 
app.get('/greeting', (req,res) => {
        
         res.send('hello ');
   });

 app.use('/', express.static('pages'));

   
app.listen(PORT, HOST);

console.log('up and running');

From the app1 directory I run: docker build -t raff/node . The image gets built with no issues. So I try to run docker with sudo docker run --rm -p 3000:8080 -v /Users/me/Desktop/app1/src:/app/src -it raff/node

So I get message that node is up and running and as soon as I open localhost:3000 I get the error message.

Could someone point it out what's wrong?

Edit: Included the absolute path that was omitted before.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!