@@ -291,20 +291,22 @@ func (c *Client) DeployWorkload(
291291		return  0 , nil 
292292	}
293293
294+ 	firstPortInt , err  :=  extractFirstPort (options )
295+ 	if  err  !=  nil  {
296+ 		return  0 , err  // extractFirstPort already wraps the error with context. 
297+ 	}
294298	if  isolateNetwork  {
295299		// just extract the first exposed port 
296- 		firstPortInt , err  :=  extractFirstPort (options )
297- 		if  err  !=  nil  {
298- 			return  0 , err  // extractFirstPort already wraps the error with context. 
299- 		}
300300		hostPort , err  =  c .ops .createIngressContainer (ctx , name , firstPortInt , attachStdio , externalEndpointsConfig ,
301301			permissionProfile .Network )
302302		if  err  !=  nil  {
303303			return  0 , fmt .Errorf ("failed to create ingress container: %v" , err )
304304		}
305305	}
306306
307- 	return  hostPort , nil 
307+ 	finalPort  :=  calculateFinalPort (hostPort , firstPortInt , permissionConfig .NetworkMode )
308+ 
309+ 	return  finalPort , nil 
308310}
309311
310312// ListWorkloads lists workloads 
@@ -1314,6 +1316,9 @@ func (c *Client) createContainer(
13141316	if  err  !=  nil  {
13151317		return  "" , NewContainerError (err , "" , fmt .Sprintf ("failed to create container: %v" , err ))
13161318	}
1319+ 	if  resp .Warnings  !=  nil  {
1320+ 		logger .Debugf ("Container creation warnings: %v" , resp .Warnings )
1321+ 	}
13171322
13181323	// Start the container 
13191324	err  =  c .api .ContainerStart (ctx , resp .ID , container.StartOptions {})
@@ -1386,10 +1391,21 @@ func (c *Client) createDnsContainer(ctx context.Context, dnsContainerName string
13861391	return  dnsContainerId , dnsContainerIP , nil 
13871392}
13881393
1389- func  (c  * Client ) createMcpContainer (ctx  context.Context , name  string , networkName  string , image  string , command  []string ,
1390- 	envVars  map [string ]string , labels  map [string ]string , attachStdio  bool , permissionConfig  * runtime.PermissionConfig ,
1391- 	additionalDNS  string , exposedPorts  map [string ]struct {}, portBindings  map [string ][]runtime.PortBinding ,
1392- 	isolateNetwork  bool ) error  {
1394+ func  (c  * Client ) createMcpContainer (
1395+ 	ctx  context.Context ,
1396+ 	name  string ,
1397+ 	networkName  string ,
1398+ 	image  string ,
1399+ 	command  []string ,
1400+ 	envVars  map [string ]string ,
1401+ 	labels  map [string ]string ,
1402+ 	attachStdio  bool ,
1403+ 	permissionConfig  * runtime.PermissionConfig ,
1404+ 	additionalDNS  string ,
1405+ 	exposedPorts  map [string ]struct {},
1406+ 	portBindings  map [string ][]runtime.PortBinding ,
1407+ 	isolateNetwork  bool ,
1408+ ) error  {
13931409	// Create container configuration 
13941410	config  :=  & container.Config {
13951411		Image :        image ,
0 commit comments