PublishAllPorts: don't crash with nil PortBindings

Introduced by commit 85b260f ("PublishAllPorts: create
port mappings for exposed ports").

Signed-off-by: Rob Murray <rob.murray@docker.com>
This commit is contained in:
Rob Murray
2025-11-29 16:01:47 +00:00
parent 2faf258d4d
commit 7517464283
3 changed files with 27 additions and 0 deletions

View File

@@ -72,6 +72,13 @@ func WithSysctls(sysctls map[string]string) func(*TestContainerConfig) {
}
}
// WithPublishAllPorts sets PublishAllPorts.
func WithPublishAllPorts(publishAll bool) func(*TestContainerConfig) {
return func(c *TestContainerConfig) {
c.HostConfig.PublishAllPorts = publishAll
}
}
// WithExposedPorts sets the exposed ports of the container
func WithExposedPorts(ports ...string) func(*TestContainerConfig) {
return func(c *TestContainerConfig) {