Port not being exposed on mac

I just started using docker on mac and I can’t figure out why the ports aren’t exposing on localhost.

Here is my Dockerfile:

FROM node:alpine
RUN apk add --update curl
RUN mkdir -p /home/app
WORKDIR /home/app
COPY . /home/app
RUN cd /home/app; npm install express
EXPOSE 8080
CMD ["node", "app.js"]

Here is my sample app:

var app = require("express")();
app.get('/', (req, res) => {
    res.send({'lorem': "ipsum"});
});
app.listen(8080);
console.log('listening on 8080');

After building, I did docker run:

docker run -d -p 8080:8080  some/test

I’ve checked the docker logs, everything is running fine. I’ve run docker exec on the container and tried to “curl” the internal port, it’s working fine. But I can’t open it on localhost.

What is wrong, am I missing something?

got it working ? I just ran your container and works fine for me.