Skip to content
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

Docker --name option #387

Closed
LordFPL opened this issue Nov 5, 2015 · 8 comments
Closed

Docker --name option #387

LordFPL opened this issue Nov 5, 2015 · 8 comments

Comments

@LordFPL
Copy link

LordFPL commented Nov 5, 2015

Hello,

Following a conversation on the newsgroup (https://groups.google.com/forum/#!topic/nomad-tool/WrTGqvjW6xo) I will wish be able to set in a Nomad job the name of a container (--name option in docker).
The reason is a easier viewing on the host machine, but also for monitoring tools that use this value.

Thanks in advance :)

@cbednarski
Copy link
Contributor

@LordFPL Container names have to be unique across the cluster (we might start more than one container from the same job on a single host), and as such they have some randomly-generated string in the name no matter what.

It seems like labels are a better fit for cross-referencing. For instance, we could attach a label to the container that indicates the name of the job that started it, and potentially other metadata Nomad has available. I think this might satisfy your use-case better. Any thoughts about this?

@LordFPL
Copy link
Author

LordFPL commented Nov 6, 2015

Thx for your answer :) I have to test if label can be a solution... but i always found name in "docker ps" more understandable than label.

Imho label are more for informations about an app (dev/prod, locality, project, team, etc...)

I understand the problem of unicity accross the cluster, but with PR #321 maybe an implicit constraint can be added ? (If option contain --name then constraint = distinctHost... or something like that...)

@cbednarski
Copy link
Contributor

The naming issue should not be conflated with a scheduling restriction. If it's your intent to never colocate two instances of a job on the same machine, that should be explicit. I think it would be surprising to most people that giving their container a name prevented it from being scheduled.

The proposed change in #389 works around the naming uniqueness issue by essentially randomizing it, so I'm curious whether the proposed solution would actually work for your intended use case.

From some brief digging I did, cAdvisor, telegraf, and Prometheus all support labels now. I think labels are probably the best solution either way, since they to not carry additional implications for the docker runtime.

@dimfeld
Copy link
Contributor

dimfeld commented Nov 10, 2015

AFAIK logspout (https://github.com/gliderlabs/logspout/) does not look at docker container labels, and logstash filters on the receiving end could easily filter out the allocation ID (or whatever gets appended) from the name. On the other hand, logspout does send the docker image name along with the log data, so that may also be sufficient for most people's needs.

@mfischer-zd
Copy link

+1

@LordFPL
Copy link
Author

LordFPL commented Nov 16, 2015

Sorry for late answer, the #389 change is a good solution imho... and will be much better than random docker names.
Many thx to have digging all tools, i have to work with label now :)

@dadgar
Copy link
Contributor

dadgar commented Nov 19, 2015

Closing this as #389 addresses it. For background we append the alloc id to ensure that the name is unique. Otherwise docker name adds the potential for conflicts.

@dadgar dadgar closed this as completed Nov 19, 2015
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants