Skip to content

No port is exposed on host for some containers #50

Description

@vjgn

I have a case where when I use docker run with "-p 1080:1080" then port 1080 is exposed and accessible from host. But when I configure the same container in fuge and run, that port is not exposed.
Below is my fuge config for this service:
worker1:
image: dsworker:123.71
type: container
environment:
- POLL_MESSAGE_COUNT=1
ports:
- worker1=1080:1080

When i do docker ps, it does not show any ports exposed.
As mentioned before, executing docker run with -p shows the port correctly in docker ps command.

After going through the docker api for create container, looks like the ExposedPorts command is at the config level and not under HostConfig. When I changed this from (in dockerRunner.js):

var createOpts = {Image: container.image,
  Tty: false,
  HostConfig: {
    ExposedPorts: ep,
    PortBindings: pb
  }
}

to

var createOpts = {Image: container.image,
  Tty: false,
  HostConfig: {
    ExposedPorts: ep,
    PortBindings: pb
  },
  **ExposedPorts: ep**
}

Then the port is correctly getting exposed on the host and I can access my service.
Is this a bug in fuge runner?

I found further that the docker file used to generate the container does not EXPOSE this port 1080. We are working to have that fixed. But still, when docker run can work correctly, fuge should also work. I think the fix above addresses this use-case.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions