Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reach additional containers by the hostname after docker-compose scale?

I'm using the docker-compose 1.6 with docker 1.10.1 and version 2 of docker-compose.yml.

As described in Networking in Compose, new network is created and all containers are assigned hostnames in it after docker-compose up.

How can I reach additional (i.e. scaled) containers via hostnames after docker-compose scale <component>=2?

like image 329
Max Romanovsky Avatar asked Mar 16 '16 09:03

Max Romanovsky


1 Answers

When using "scale", internal docker dns service resolves only full names like projectname_db_1, projectname_db_2 and so on. Certainly, it would be better to provide in addition resolving service name + index without project name prefix.

like image 173
Roman Navrotskii Avatar answered Oct 19 '22 23:10

Roman Navrotskii