containerd / nerdctl

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

`name/identifier` grammar is different for docker and nerdctl #3115

Open apostasie opened 1 week ago

apostasie commented 1 week ago

Description

Triggered this on create, but it is the same on run AFAIK.

If I am not mistaken, it seems to me that Docker is using: ^[a-zA-Z0-9][a-zA-Z0-9_.+-]+$ (seen in cli/cli/context/store/store.go) while we use Validate from containerd/identifiers that only allows single separators followed by alpha num: ^[A-Za-z0-9]+(?:[._-](?:[A-Za-z0-9]+))*$

Steps to reproduce the issue

docker create --name nerdctl-teststartinteractive-create-false-false--true-false alpine
6d927047daa959bec273fd5945fd541b7e38a065e8b2ef0b196cafbb64f6c02e

nerdctl create --name nerdctl-teststartinteractive-create-false-false--true-false alpine
FATA[0000] invalid name "nerdctl-teststartinteractive-create-false-false--true-false": identifier "nerdctl-teststartinteractive-create-false-false--true-false" must match ^[A-Za-z0-9]+(?:[._-](?:[A-Za-z0-9]+))*$: invalid argument

Describe the results you received and expected

Consistency between docker and nerdctl.

Since we would make this more loose instead of stricter, I don't think it would be a problem.

Unless there is a reason to keep this behavior, I can send a PR to loosen this up.

We should also review everywhere we are using Validate, besides container names.

What version of nerdctl are you using?

1.7.6

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

Host information

No response

apostasie commented 1 week ago

Let me know what is desired here - align with docker or keep our somewhat "stricter" behavior.

AkihiroSuda commented 1 week ago

+1 on aligning with docker