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

Provide container name (and/or its number) in environment variables #2432

Closed
valyagolev opened this issue Nov 20, 2015 · 1 comment
Closed

Comments

@valyagolev
Copy link

It would be very useful if there was a way to find out the container name (like, projectname_webserver_1) from inside of it, to use it as some kind of an id (like for kafka, or in the logs).

The only way to get it which I could find is by parsing it out from some *_NAME environment variable, which requires the container to have links, and feels bad.

@dnephin
Copy link

dnephin commented Nov 20, 2015

You can use the hostname as a unique id, which is the unique container id, by using $(hostname).

This issue is a duplicate of #1503

@dnephin dnephin closed this as completed Nov 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants