Docker Community Forums

Share and learn in the Docker community.

docker-compose port expose not working on mac 10.13.6 (High Sierra)

docker

(Codeaire) #1

I have a docker container that hosts a Node application. I am trying to connect the application using following URL https://localhost:8000, but the connection is refused.

My docker-compose file is

version: '3'
services:
  console:
    build: .
    ports:
    - "8000:8000"
    image: console:cp
    volumes:
    - .:/usr/src/app
    - /usr/src/app/node_modules

And my Dockerfile is

FROM node:10

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)

RUN npm install -g nodemon

COPY package*.json ./


RUN npm install
# If you are building your code for production
# RUN npm install --only=production

# Bundle app source
COPY . .

EXPOSE 8000
CMD [ "nodemon", "start" ]

tried following command and it didn’t work either:

docker run -p 8000:8000 console:cp nodemon index.js

Some more details

docker-compose version 1.22.0, build f46880f
Docker version 18.06.0-ce, build 0ffa825
MacOSX 10.13.6 (High Sierra)

Any ideas? Thanks in advance.


(Tnegeli) #2

You try to connect via HTTPS, which is port 443.
Have you tried http://localhost:8000