aspire
aspire copied to clipboard
Container port not exposed when using `WithVolume()`
I noticed that when I added .WithVolume(), the created container is not exposing the port.
Relevant code:
var postgresPassword = builder.AddParameter("postgresql-password", secret: true);
var postgres = builder.AddPostgres("postgres", password: postgresPassword, port: 63015)
.WithVolume();
Without WithVolume()
With WithVolume()
That code sample you pasted doesn't compile. WithVolume takes a required argument. Is that the code you are actually using?
Sorry, I was actually using WithDataVolume() but I found similar issue from StackOverflow so I thought I'd change it to WithVolume() for this report.
Everything seems to be working fine but the docker desktop UI does not show the ports. It doesn't seem to be related to using volumes either:
That's weird. I've tried multiple times and it sometimes exposes the port other times not. Could just be a problem with my machine. Sorry to bother you. Thanks for taking the time looking into this.
Could this be a variation of #4066? If the new postgres container tries to start up before the previous one has fully shut down, the port may be blocked by the old instance.
This smells more like a Docker Desktop UX bug.
Could this be a variation of #4066? If the new postgres container tries to start up before the previous one has fully shut down, the port may be blocked by the old instance.
If that were the case, the container would just fail to start, and not run without the port mapping. So I doubt this is related to #4066
Looks like this is external to Docker Desktop. Going to close but if you run into an issue where Aspire is not binding the ports correctly, re-open this.