Skip to content

Commit 554b569

Browse files
committed
Make the port flag work
1 parent 73bca79 commit 554b569

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/tools_code_server.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,16 @@ func NewCodeServerNode(name, image, labsDir string, port uint, runtime clabrunti
136136
return nil, fmt.Errorf("failed to create container port: %w", err)
137137
}
138138
exposedPorts[containerPort] = struct{}{}
139+
140+
var hostPort uint = 0
141+
if port != 0 {
142+
hostPort = port
143+
}
144+
139145
portBindings[containerPort] = []nat.PortBinding{
140146
{
141147
HostIP: "0.0.0.0",
142-
HostPort: "",
148+
HostPort: fmt.Sprintf("%d", hostPort),
143149
},
144150
}
145151

0 commit comments

Comments
 (0)