Skip to content

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

Closed
@apostasie

Description

@apostasie

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions