-
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
Proposal: Stop using sequential container numbers #1516
Comments
For scripts is useful ps command with -q option. If there is option for get my only one container there would be no need for some explicit naming. |
I just wondered what were the plans for this feature? Is it planned soon? |
Hey Simon! We aren't doing anything about this in the 1.5 release (which will be out soon), but I think we may look to implement something in the 1.6 release which will be a few months away. |
+1 I want to run parallel copies of a container in a data processing pipeline. If there were a |
Another use case where this would be useful is if the prefix - the directory of the For example, having two apps with the following structure:
and assuming they both use a A not so great solution would be to use the complete EDIT: I just found out about the --projectname command line option which solves my particular problem. Although the question about why should we even give a name still stands. |
The project name is required to support isolated environments. |
👍 |
@dnephin, just wondering, are you still planning to remove the sequential container numbers? |
I just came across this issue when CI executes tests in parallel (triggered by different commits). I handled it by generating a random name for the container like so:
|
Thanks @kchudy . I had to use
|
Related: #4688 |
Is pure naive randomness enough to solve the parallel IMHO a mechanism is needed in addition to query a number for being free & reserve it in one atomic step. This should be less work performance-wise than going through all numbers to find the next higher one as of now, but it's still more complex than simply throwing a dice and using that number without any further considerations. However, I guess it begs the question who keeps track of the reservations - something in the file system? The docker daemon? .. |
@Jonast That's just not an issue in practice: https://en.wikipedia.org/wiki/Universally_unique_identifier#Collisions |
@shin- true if you use UUIDs. This wasn't confirmed before, and I kind of thought you might use a random 64bit int or similar. In hindsight, I suppose just using UUID4 solves this. Just as a relevant side note, are all modern systems equipped with sufficiently good entropy sources? I know some embedded systems aren't, I'm just pointing out in case it is relevant. |
Fix docker#1516 Signed-off-by: Svyatoslav Ilinskiy <ilinskiy.sv@gmail.com>
It's a shame that this has to be an issue. While it may not work in your use cases, there are so many other situations where this isn't a problem, sometimes simply testing services at scale. The use of hostnames in some cases can greatly help to identify services, and the ability to generate unique hostnames, whether sequentially numbered or randomly generated, is sometimes a requirement that cannot be ignored. Take for example a service which identifies itself via it's hostname which must be unique within a cluster. The choice currently is: use randomly generated container hostnames, e.g. I hope that you can see this, and perhaps in time, introduce it. We've come a long way since 2013, but we still have so far to go. |
What @adamkdean said : “Simply exposing a ${SCALE} variable would solve a lot of problems without introducing any.” |
Is there a way to programmatically query what the containers for a service are? How can I refer to them externally from a program if I don't know what the names are? |
@sergiogiro |
Thanks, appreciated. Plus This change to docker compose broke our integration tests (as CircleCI automatically updated to the new version), and it was quite difficult to see why. FWIW, I think that a less traumatic implementation path would have been:
|
Oh, and including @ngrilly 's one liner (plus |
@sergiogiro I forgot about this: if your run multiple projects, you should also specify the project: |
The default naming scheme has changed from 1.22 to 1.23. |
Copying what I wrote in #6140 : While this can be seen as a breaking change in the sense that container names can no longer be inferred the way they could before, it should be noted that
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it had not recent activity during the stale period. |
Sequential container numbers (
myapp_web_1
,myapp_web_2
) are problematic.myapp_web_LASTNUM
goes down at the same time as Compose is querying the cluster, it will incorrectly thinkLASTNUM
is the next number we should use. Once the node comes up, there'll be a clash of container names.docker-compose run
s in parallel.As such, I think we should start using random suffixes. This may well break some scripts that rely on container names, but now that we're using labels to track containers, we should be explicit about making no guarantees about container names.
The text was updated successfully, but these errors were encountered: