# DbGateContainerResource.WithHostPort

- Module: [CommunityToolkit.Aspire.Hosting.DbGate](/reference/api/go/communitytoolkit.aspire.hosting.dbgate.md)
- Defined on: [DbGateContainerResource](/reference/api/go/communitytoolkit.aspire.hosting.dbgate/dbgatecontainerresource.md)
- Version: `13.6.1`
- Kind: `method`

Configures the host port that the DbGate resource is exposed on instead of using randomly assigned port.

## Definition

```go
type DbGateContainerResource interface {
    // ... omitted for brevity
    WithHostPort(port *float64) DbGateContainerResource
}
```

## Signature

```go
WithHostPort(port *float64) DbGateContainerResource
```

## Parameters

- `port` (`*float64`) -- The port to bind on the host. If `null` is used random port will be assigned.

## Returns

[`DbGateContainerResource`](/reference/api/go/communitytoolkit.aspire.hosting.dbgate/dbgatecontainerresource.md) -- The resource builder for DbGate.

Returns a handle; failures surface later via `Err()`.

## Defined on

- [DbGateContainerResource](/reference/api/go/communitytoolkit.aspire.hosting.dbgate/dbgatecontainerresource.md) -- `handle`
