# WithContainerFiles

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`ContainerResource`](/reference/api/go/aspire.hosting/containerresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Creates or updates files and folders in a container by copying them from a source path on the host.

## Remarks

In run mode, Aspire copies the files into the container and applies owner, group, and umask options.
In publish mode, Aspire creates a read-only bind mount and ignores those options.
To produce entries dynamically (including inline file contents and OpenSSL certificate files), polyglot AppHosts
use the `withContainerFilesCallback` overload and build the entries via the factory methods on
`ContainerFileSystemCallbackContext`. Passing a pre-built `ContainerFileSystemItem` collection
remains .NET-only.

## Definition

```go
func (ContainerResource) WithContainerFiles(
    destinationPath string,
    sourcePath string,
    options ...*ContainerFilesOptions,
) ContainerResource
```

## Parameters

- `destinationPath` (`string`) -- The destination absolute path in the container.
- `sourcePath` (`string`) -- The source path on the host to copy files from.
- `options` (`...*ContainerFilesOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed as the existing [`*ContainerFilesOptions`](/reference/api/go/aspire.hosting/containerfilesoptions.md) struct.

## Returns

[`ContainerResource`](/reference/api/go/aspire.hosting/containerresource.md) -- The resource builder.

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

## Applies to

- [`ContainerResource`](/reference/api/go/aspire.hosting/containerresource.md)
