AliyunContainerService / pouch

An Efficient Enterprise-class Container Engine
https://pouchcontainer.io
Apache License 2.0
4.64k stars 949 forks source link

bug: we could create container with invalid name #2918

Closed lang710 closed 2 years ago

lang710 commented 5 years ago

Ⅰ. Issue Description

when we create a container, there are no strict restrictions on the name format. I think we should improve it.

Ⅱ. Describe what happened

Example:

root@compatibility:~# pouch run --name new:invalid busybox top
root@compatibility:~# pouch ps
root@compatibility:~# Name           ID       Status         Created         Image            Runtime
new:invalid   9e1627   Up 5 seconds    4 seconds ago   busybox:latest   runc

Ⅲ. Describe what you expected to happen

There should be an Error response from daemon. Actually, container name (new:invalid), only [a-zA-Z0-9][a-zA-Z0-9_.-] should be allowed.

Ⅳ. How to reproduce it (as minimally and precisely as possible)

1. 2. 3.

Ⅴ. Anything else we need to know?

I think the format of the input of all instructions' parameters should be strictly limited.

Ⅵ. Environment: