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
Support custom container names #1518
Comments
@aanand web:
image: myimage
name: webapp-###
|
I just read #1516 now sorry. |
@aanm how would that differ from 2. beside the syntactical difference? atm, a name-property is added upon creation of a service-dict anyway. my guess is that it gets discarded when containers are created. yep, 1. seems best. why would one not identify scaled services via the labels and implement a parsing of names?! |
Simply that the container name is no longer predictable. The basic use case is this:
If the container will always have an unpredictable suffix ( |
@aanand I disagree on using |
I think it boils down to choosing either name predictability, or scaling. When interacting with scalable containers, how would one even choose, which out of N to interact (e.g. link) with? Those, who want their containers to scale, should allow certain containers to do it by not specifying a custom name. So I'm for option 1 here. |
How about letting the user choose it's own naming/scaling rules/formula? |
This is more the image built name than the container name that I'd really want to customize. |
This feature will be usefull also when container's build depends on another, example : base/Dockerfile
nodejs/Dockerfile
docker-composer.yml
So the name will be helful to keep link between generated containers. |
Are you setting milestone 1.3.0 for this feature ? |
@mariolameiras No, 1.3.0 is in code freeze. |
👍 how do you call containers from compose atm if the id is changing all the time? |
👍🏾 |
3 similar comments
+1 |
+1 |
+1 |
I agree (partly) with @aanm here; docker compose should be able to exist here, either by being able to start, and link, a container or by providing the actual container name. Thinking something like this;
This is a good / valid point. I think the new networking features (currently experimental); moby/moby#14083 and the related discussions should be taken into account here as well moby/moby#13441 moby/moby#13977 moby/moby#14143 IIUC, plans are to move away from explicitly / hard linking to containers and more towards creating a "network" (i.e. a group of containers / end points that can communicate) and use "discovery" to find a service to connect to. |
If you want to get the ids of all containers for a service:
If there are multiple, and you just want to get one:
So if you want to link to a Compose container in a
|
Hello! |
Requested in #652 and #1347.
It would be nice to allow users to customise container names, perhaps with a
name
field:However, it might not play nicely with
docker-compose scale
, since names are supposed to be unique.Some options, keeping in mind that sequential suffixes are probably going away (#1516):
webapp_1a2b3c
,webapp_4d5e6f
,webapp_7a8b9c
Easy enough, but the feature becomes somewhat less useful at that point.
3. Automatically append a suffix to the name of all but the first container:
webapp
,webapp_1a2b3c
,webapp_4d5e6f
It works, but it's more complicated. What does the logic for creating/scaling look like now?
The text was updated successfully, but these errors were encountered: