PublishAllPorts: don't crash with nil PortBindings#51621
PublishAllPorts: don't crash with nil PortBindings#51621thaJeztah merged 1 commit intomoby:masterfrom
Conversation
Introduced by commit 85b260f ("PublishAllPorts: create port mappings for exposed ports"). Signed-off-by: Rob Murray <rob.murray@docker.com>
eb9888f to
7517464
Compare
| imgWithExpose := container.WithImage(build.Do(ctx, t, c, | ||
| fakecontext.New(t, "", fakecontext.WithDockerfile("FROM busybox\nEXPOSE 80/tcp\n")))) |
There was a problem hiding this comment.
Silly question; does this require the image to have the exposed ports set, or would the same work when creating the container with --expose ?
(Mostly looking if we can avoid using docker build as part of test preparation if it's not needed)
There was a problem hiding this comment.
The same should work for a container --expose ... I did it this way because the build command in the test was trivial, and it seemed more likely to be testing something a user would do (I'm guessing --expose with a -P on the container is unusual, compared with -p).
The test runs in < 1s, but the build is a bit log-spammy. Can change it, or test both ways?
There was a problem hiding this comment.
Yeah, either way is probably fine; I recall we had some cases where the build itself was more problematic than the test.
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM
left one question, but definitely not a blocker
- What I did
- How I did it
- How to verify it
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)