maybeEmulateAmd64 method

DockerContainer maybeEmulateAmd64()

Conditionally adds platform: 'linux/amd64' emulation when running on an ARM64 host (e.g. Apple Silicon).

No-ops on x86-64, when emulation is already configured ('platform' key already present in kwargs), or when the current platform is not ARM.

Returns this for chaining.

Implementation

DockerContainer maybeEmulateAmd64() {
  if (isArm() && !_kwargs.containsKey('platform')) {
    return withKwargs({'platform': 'linux/amd64'});
  }
  return this;
}