-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uppercase letters in service names result in Docker API errors #1416
Comments
I think we could do option 3, but continue to name images with a lowercased version of the name by default. Conflicts shouldn't be a problem, because even if one project overrides another, the labels will still point at the right container/image (the image will just lose its tag). |
I would recommend taking the hit with number 1. Case-sensitivity brings nothing but heartbreak. When it comes down to it, humaans don't really consider "foo" and "Foo" to be that different. We did actually make the registry API case-sensitive, leaving it to the backend to "decide". Originally, it was all case-insensitive but that broke some tags. If you're going to use a label, it should just be a unique identifier, allowing the image name and service name to not be linked. The root of the problem is that the naming domains require compatibility. |
I like the approach number 1 as well despite the fact that it breaks backwards compatibility. This would be particularly useful for "service discovery for docker containers via DNS" projects like tonistiigi/dnsdock where I am struggling precisely with the fact that my container had upper-case characters and the DNS query could not match it. Enforcing choice number 1 would allow for unique DNS entries for services as a pretty awesome side-effect of fixing the compose issue. DNS protocol and all of the web rely on case-insensitive URLs. The case-insensitive model works quite well; can you imagine the implications of www.google.com != www.GOOGLE.com? It would be a nightmare from a debugging, security, and user experience perspective. Choice number 1 all the way! |
With #2092 we have a way to customize the image name instead of using the default service name. If the service name isn't used for the image name, we don't have a problem. When |
For reference, we've actually compiled a grammar for image names: https://github.com/docker/distribution/blob/master/reference/reference.go#L1 This was quite an effort to satisfy everyone. Case-sensitivity and hostname compatibility were basically mutually incompatible and we went with what is familiar in URLs. (As @conz27, this choice is ultimately easier for users, sometimes). Could compose simply normalize the case for the docker image when doing lookups? I think I said I favored option number 1 above, but number 2 would be easier on the user. |
Thanks for the update, @stevvooe. Amazing how quickly we end up inventing mini-languages. The case against Option 1 has weakened slightly because we're about to implement a new version of the Compose file format and can make backwards-incompatible changes, so perhaps this is a good opportunity to do so. I've added this issue to the list in #2504. |
Worth noting: we now have the additional issue that we allow |
This is a mistake commonly made by trainee falconers. Its actually a micro-format.
I would suggest the new Compose format adopt the grammar from above. We are open to additions that are backwards compatible and reasonable. This may actually be supported. I am going to do a quick refactor of the grammar to make it more clear. |
I think restricting the service name to be compatible with the image naming format is unnecessary. Since we're going to support custom names with #2092, all we really need to do is normalize the default image name for the case where they don't provide one (by removing any invalid characters and converting it to lowercase, basically option 2). We just recently added support for "-_." in service names, it would be a shame to remove it again. |
@dnephin Image names allow "-.", just fine. They disallow silly uses and insecure uses, such as "foo", "foo---_-___bar". |
@stevvooe understood. My argument is that the naming restrictions for images make sense for images, but don't necessary make much sense for service names, which are not purely for creating an image. They're a way to refer to a service locally. |
@dnephin @aanand I've refactored the grammar quite a bit to clean it up in distribution/distribution#1239. Let me know which cases you want to support and we can see where the disconnects really are. I do understand that it would be nice to decouple the names, but if we can bring it under this grammar, it may provide some flexibility in the future. |
@dnephin that's true, I hadn't considered that. If we go down that route, we have a choice about whether to auto-munge the name or to raise an error if it's incompatible and make the user specify a tag. I'm leaning towards the latter at the moment, as long as we make the error sufficiently helpful. |
We allow uppercase letters in service names, but Docker doesn't allow them in image names.
When you use
build
, the name of the image we create is based on the service name. If it contains uppercase letters, Docker will refuse to create it.Some options:
But we've got to name them something, and it would be quite unhelpful not to incorporate the service name - right now it's nice that when I run
docker images
I can see which ones come from Compose, and what project/service they belong to.The text was updated successfully, but these errors were encountered: