Docker compose service name and hostname

3.1k views Asked by At

Recently I come across a docker-compose file with the below content:

version: '3'
services:
  serviceA:
    image: someService
    hostname: local_serviceA

I know when calling different services amount the same network, we can refer to the service name. For example, we can use http://serviceA to call serviceA.

But what is the use of the hostname field. Can other containers call service A using local_serviceA.

I have read this post but don't really understand. Can anyone help? Thanks in advance.

0

There are 0 answers