Skip to content

Commit f2bf9d7

Browse files
committed
fix: Set Platform.Value
1 parent 3dfe17a commit f2bf9d7

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

docs/api/create_docker_container.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ _ = new ContainerBuilder()
1515

1616
For more advanced scenarios, `WithImage` also supports `IImage`, giving you more control over how the image is represented and its properties are resolved.
1717

18-
If you need to target a specific platform, the `DockerImage` implementation provides an overload that lets you explicitly set the platform, such as `linux/amd64`.
18+
If you need to target a specific platform, the `DockerImage` implementation provides an overload that lets you explicitly set the platform, such as `linux/amd64`. By default, the container runtime uses the platform that matches the container host.
1919

2020
```csharp
2121
_ = new ContainerBuilder()
@@ -24,7 +24,7 @@ _ = new ContainerBuilder()
2424

2525
!!!tip
2626

27-
A specifier has the format `<os>|<arch>|<os>/<arch>[/<variant>]`. The user can provide either the operating system or the architecture or both. For more details, [see containerd/platforms](https://github.com/containerd/platforms).
27+
A specifier has the format `<os>|<arch>|<os>/<arch>[/<variant>]`. The user can provide either the operating system or the architecture or both. For more details, see [containerd/platforms](https://github.com/containerd/platforms).
2828

2929
## Configure container start
3030

src/Testcontainers/Images/DockerfileArchive.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,13 @@ public IEnumerable<IImage> GetBaseImages()
162162
.ToArray();
163163

164164
var images = fromMatches
165-
.Select(match => (Arg: match.Groups[argGroup], Image: match.Groups[imageGroup]))
166-
.Select(item => (Arg: ReplaceVariables(item.Arg.Value, args), Image: ReplaceVariables(item.Image.Value, args)))
165+
.Select(match => (FromArgs: match.Groups[argGroup], Image: match.Groups[imageGroup]))
166+
.Select(item => (FromArgs: ReplaceVariables(item.FromArgs.Value, args), Image: ReplaceVariables(item.Image.Value, args)))
167167
.Where(item => !item.Image.Any(char.IsUpper))
168168
.Where(item => !stages.Contains(item.Image))
169169
.Select(item =>
170170
{
171-
var fromArgs = ParseFromArgs(item.Arg).ToDictionary(arg => arg.Name, arg => arg.Value);
171+
var fromArgs = ParseFromArgs(item.FromArgs).ToDictionary(arg => arg.Name, arg => arg.Value);
172172
_ = fromArgs.TryGetValue("platform", out var platform);
173173
return new DockerImage(item.Image, new Platform(platform));
174174
})

src/Testcontainers/Images/Platform.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public readonly struct Platform
2222
[PublicAPI]
2323
public Platform(string value)
2424
{
25+
Value = value;
2526
}
2627

2728
/// <summary>

0 commit comments

Comments
 (0)