docker-topo icon indicating copy to clipboard operation
docker-topo copied to clipboard

Ports do not get published

Open mbound opened this issue 6 years ago • 3 comments

Hi, I am trying to publish ports to the host from one container in my topology, but even though the docker-topo --create script appears to succeed, the port doesn't get published.

Here is the topology I am using:

VERSION: 2

CUSTOM_IMAGE:
      onos: onosproject/onos
PUBLISH_BASE:
      8181/tcp: 8383 # publish GUI port to host
#driver: veth
links:
    - endpoints: ["vmx-a1:eth0", "vmx-g1:eth0","vmx-b1:eth0","vmx-g2:eth0","onos:eth0"]
      driver: bridge

mbound avatar Oct 16 '19 13:10 mbound

Actually, I've managed to answer my own question. I read through the source code and I can see that port publishing is by default only supported for CEOS and VEOS images (it wasn't apparent from the documentation).

With some tweaking to the code I was able to get it to work for the ONOS container as well.

Quick question though: why is it explicitly disabled for all other images including Alpine hosts? The port publishing is implemented by Docker's API, so it shouldn't matter what VM/container image you are running internally, provided that it exposes the port you are looking for, right?

mbound avatar Oct 16 '19 13:10 mbound

AFAIR, I only needed it for ceos/veos initially, hence https://github.com/networkop/docker-topo/blob/master/bin/docker-topo#L733 But yeah, it shouldn't make any difference what image it is, so feel free to do a PR if you want this upstreamed.

networkop avatar Oct 16 '19 20:10 networkop

Thanks! I will clean it up a bit and do a PR as soon as i have a bit of time.

mbound avatar Jan 14 '20 17:01 mbound