include exposed ports in container ports config

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2021-07-30 11:14:26 +02:00
parent 377493d473
commit 94997be633
No known key found for this signature in database
GPG Key ID: 9858809D6F8F6E7E
1 changed files with 4 additions and 0 deletions

View File

@ -527,6 +527,10 @@ func setBlkio(blkio *types.BlkioConfig, resources *container.Resources) {
func buildContainerPorts(s types.ServiceConfig) nat.PortSet {
ports := nat.PortSet{}
for _, s := range s.Expose {
p := nat.Port(s)
ports[p] = struct{}{}
}
for _, p := range s.Ports {
p := nat.Port(fmt.Sprintf("%d/%s", p.Target, p.Protocol))
ports[p] = struct{}{}