Skip to content

--net=host option does not seem to work #937

@zerefel

Description

@zerefel

Expected behavior

Running a server on port 3000, in a container which exposes port 3000 should map the container to localhost:3000.

Actual behavior

Accessing localhost:3000 in the browser results in ERR_CONNECTION_REFUSED. However, the container is started successfully and the server starts listening on port 3000.

Information

  • Diagnostic ID: 3F7A5024-D386-4782-8CBD-DFEB8343EE67/2017-07-19_21-23-58

  • OS: Windows 10

  • Docker version: 17.06.0-ce, build 02c1d87

  • Dockerfile:

FROM node:8

ADD package.json /tmp/package.json
RUN cd /tmp && npm install
RUN mkdir -p /usr/src/app && cp -a /tmp/node_modules /usr/src/app

RUN npm i -g forever

WORKDIR /usr/src/app
ADD . /usr/src/app

EXPOSE 3000
CMD npm run server:prod

Steps to reproduce the behavior

  1. docker build -t sample_service .
  2. docker run --net=host sample_service

Additional information

Running the same service in bridge mode docker run -p 3000:3000 sample_service works just fine.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions