Docker Compose - port issues. Unable to launch project on localhost

I am on a mac (El Capitan, stable, 10.11.6) with Docker for Mac stable installed.

I am running a simple javascript app on the official node image. Here’s what the Dockerfile looks like:

FROM node

WORKDIR /usr/local/src

And here’s the docker-compose.yml:

version: '2'

services:
  web:
    container_name: myproject_dev
    build: .
    command: npm run development
    ports:
     - "1234:8000"
     - "1235:8080"
     - "80:80"
    volumes:
      - ./my-project:/usr/local/src

Running docker-compose up starts everything normally:

myproject_dev | http://localhost:8080/webpack-dev-server/
myproject_dev | webpack result is served from /assets/
myproject_dev | content is served from /usr/local/src

And docker ps shows that the ports are mapped:

CONTAINER ID        IMAGE                        COMMAND                 CREATED             STATUS              PORTS                                                                NAMES
820694f618b4        myproject_web   "npm run development"   20 minutes ago      Up 20 minutes       0.0.0.0:80->80/tcp, 0.0.0.0:1234->8000/tcp, 0.0.0.0:1235->8080/tcp   myproject_dev

But I am unable to see the project page on the browser (using localhost:1234). Works fine when I run the project outside the docker. So, an issue with the project is ruled out.

Tried the following:

  1. use a different node docker
  2. switch between docker beta and stable versions
  3. stop all host apache/nginx services

But no luck :frowning: What am I missing here?