compose: Uppercase letters in service names result in Docker API errors

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:

  1. Don’t allow uppercase letters in service names. Nice and strict, but backwards-incompatible.
  2. Do allow them, but convert to lowercase when generating an image name. This will break in the extremely unlikely scenario that two services have the same name with different case. We could check for and forbid that case if we felt like it.
  3. Wait for images to be searchable by label, use labels for images (which we’re going to do anyway, see #1403), and stop naming images based on the service name altogether.

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.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

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.