# Placement Properties

- Package: [Aspire.Hosting.Docker](/reference/api/csharp/aspire.hosting.docker.md)
- Type: [Placement](/reference/api/csharp/aspire.hosting.docker/placement.md)
- Kind: `Properties`
- Members: `2`

Represents the placement configuration for a Docker service in a Swarm cluster. This class is used to define specific constraints and preferences for the placement of tasks or containers.

## Constraints

- Name: `Constraints`
- Modifiers: `nullable` `get; set`
- Returns: `List<string>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Docker/Resources/ServiceNodes/Swarm/Placement.cs)

A collection of constraints that define where tasks can be scheduled within a Swarm cluster. These constraints act as filters, ensuring that tasks are only placed on nodes that match all the specified conditions.

```csharp
public List<string>? Constraints { get; set; }
```

## Preferences

- Name: `Preferences`
- Modifiers: `nullable` `get; set`
- Returns: `List<Dictionary<string, string>>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Docker/Resources/ServiceNodes/Swarm/Placement.cs)

Gets or sets the preferences for the placement strategy in the Swarm service nodes.

```csharp
public List<Dictionary<string, string>>? Preferences { get; set; }
```

## Remarks

The preferences configuration is represented as a list of dictionaries, where each dictionary specifies key-value pairs that define custom placement preferences for the service.
