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

names of containers are not consisistent #67

Closed
mayeulk opened this issue Aug 9, 2018 · 2 comments
Closed

names of containers are not consisistent #67

mayeulk opened this issue Aug 9, 2018 · 2 comments

Comments

@mayeulk
Copy link

mayeulk commented Aug 9, 2018

PROJECT_ID := dockerosm

see also https://github.com/kartoza/docker-osm/issue_comments#issuecomment-411777356

In my setting (ubuntu 16.04), compared with the container names in this Makefile, mine have _1 at the end, such as:

dockerosm_db_1
dockerosm_imposm_1
dockerosm_osmupdate_1

Hence, many commands from the Makefile based on $(PROJECT_ID) do not work.

@mayeulk
Copy link
Author

mayeulk commented Aug 13, 2018

I could not find official documentation of why "_1" is added, but some useful discussions here and there:

docker/compose#472
https://stackoverflow.com/questions/46446135/docker-compose-avoid-docker-containers-being-named-with-underscore

Also, possibly below, a solution? Use explicit naming and take advantages of labels?

docker/compose#652 (comment)

Right now, Compose uses a naming convention (projectname_servicename_instance) in order to "identify" which containers belong to which project, because there are no other ways to do that.
Now that labels are possible, labels can be used to "identify" the containers, without having to use a special naming.
For example, by starting a container named foobar but adding some labels;
> --label com.docker.compose.project=myproject
--label com.docker.compose.service=web
--label com.docker.compose.instance=1

With those labels, compose is able to determine that the container belongs to project myproject, that it is the container for the web service, and that it is the "first" (1) instance.

The name of the container is no longer relevant and can be changed/customized without problems.
Also docker supports filtering based on labels, so to find all containers belonging to a project, compose can use docker ps --filter label=com.docker.compose.project=myproject to find all containers belonging to project my project.

mayeulk added a commit to mayeulk/docker-osm that referenced this issue Aug 14, 2018
container names end up with underscores and a number as "_1" in my setup. See kartoza#67

In my setting (ubuntu 16.04), compared with the container names in this Makefile, mine have _1 at the end, such as:

dockerosm_db_1
dockerosm_imposm_1
dockerosm_osmupdate_1
@Gustry
Copy link
Collaborator

Gustry commented Sep 1, 2018

This should be fixed in #70

@Gustry Gustry closed this as completed Sep 1, 2018
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