#Regression: new service API doesn't honor ports exposed by image?

1 messages ยท Page 1 of 1 (latest)

waxen zephyr
#

It appears that when introspecting ports from a service created directly from a container, the ports exposed in the container image are not passed through to Ports()? This is different from the pre-0.9 behavior which did pass through exposed ports with, well ExposedPorts.

  • Is this in fact the behavior?
  • Is this intentional?
  • How can I unbreak my code?
#

Regression: new service API doesn't honor ports exposed by image?

quiet roost
#

I was using Ports() on 0.9.1, I haven't tested to see if it broke on 0.9.2

waxen zephyr
#

Example snippet:

nginx := dag.
  Container().
  From("nginx").
  AsService()
ports, _ := nginx.Ports(ctx)

fmt.Printf("There are %d exposed ports\n", len(ports))
  • Expected output: There are 1 exposed ports (The nginx image exposes port 80 by default)
  • Actual output: There are 0 exposed ports
quiet roost
#

ah but it might not work with the default exposed ports ๐Ÿค” I was explicitly exposing ports

waxen zephyr
#

Yeah I'm specifically talking about ports exposed in the image

wanton umbra
#

Seems like a regression to me also. I recall using ExposedPorts in the past as well ๐Ÿ™

grizzled steppe
#

Can someone open an issue somewhere for this? Looks like the regression is confirmed, just aware that discord is a bad place to track things.

wanton umbra
#

on it Justin

wanton umbra
waxen zephyr
#

Ah I missed that, thanks. In my case it doesn't help though, since in practice you find yourself passing the Service object around, so I don't actually have access to the underlying Container (and there may not be one)

#

So technically not an API regression, but definitely a functional regression

wanton umbra
#

๐Ÿ‘ I'll put this in the issue. I posted my message before while writing it