This is how name containers are for docker containers so that they can manage them.
The base name is the name of the directory containing the docker-compose.yaml . It is followed by the container name specified in your docker-compose.yaml , and finally, followed by the instance number, which increases if you call multiple instances of the container using something like docker-compose scale .
This naming scheme is how the docker-compose command can identify your containers when you try to work with them using something like docker-compose stop .
I do not think this is somehow in conflict with the documentation. That is, if I start with, say, this docker-compose.yaml in a directory called sotest :
irc: image: docker.io/xena/elemental-ircd links: - web web: image: larsks/thttpd
And then create the composition:
$ docker-compose up
I get two containers:
CONTAINER ID IMAGE ...NAMES 960c1491c03e docker.io/xena/elemental-ircd ...sotest_irc_1 422bba313e71 larsks/thttpd ...sotest_web_1
If I look at the /etc/hosts inside sotest_irc_1 , I see:
172.17.0.28 web 422bba313e71 sotest_web_1
In addition to a number of other names. Thus, the linked node is accessible by name, as described in the docs.
larsks
source share