containerd / nerdctl

contaiNERD CTL - Docker-compatible CLI for containerd, with support for Compose, Rootless, eStargz, OCIcrypt, IPFS, ...
Apache License 2.0
8.14k stars 605 forks source link

Allow default platform to be specified with NERDCTL_DEFAULT_PLATFORM / DOCKER_DEFAULT_PLATFORM #1154

Open johnklehm opened 2 years ago

johnklehm commented 2 years ago

What is the problem you're trying to solve

I want to run x86 containers on macOS aarm64. Im faced with setting platform: linux/amd64 in all my compose files and passing --platform x86_64 on all my command line invocations. It'd be nice to set this in an env var in my profile or in a config file (probably the option for either is nice).

Describe the solution you'd like

docker supports this with the DOCKER_DEFAULT_PLATFORM env var....could support that directly or simply have a dedicated nerdctl version: NERDCTL_DEFAULT_PLATFORM.

Additional context

No response

AkihiroSuda commented 2 years ago

I guess we should extend https://github.com/containerd/nerdctl/blob/master/docs/config.md to support specifying the default nerdctl run template and the nerdctl build template

Zheaoli commented 2 years ago

I guess we should extend https://github.com/containerd/nerdctl/blob/master/docs/config.md to support specifying the default nerdctl run template and the nerdctl build template

I think this is making sense

How about this?

[default-run-config]
network="xxx"
[default-build-config]
platform="xxx"

I think to exposure network and platform filed maybe is enough for now.

YangKian commented 2 years ago

Hi @AkihiroSuda @Zheaoli , I‘d like to have a try, can you assign this to me?

Zheaoli commented 2 years ago

Hi @AkihiroSuda @Zheaoli , I‘d like to have a try, can you assign this to me?

Of course