I'm new to docker-compose but my intuition is that it should not matter at all how a service is named, like a variable in a programming language. Is that correct and is there some obscure bug or is there some magic in the background that I don't understand?
The following example from the bitnami phppgadmin repository only works if the service is named exactly "postgresql":
version: '2'
services:
postgresql:
image: docker.io/bitnami/postgresql:11
environment:
- POSTGRESQL_PASSWORD=bitnami
volumes:
- 'postgresql_data:/bitnami'
phppgadmin:
image: docker.io/bitnami/phppgadmin:7
ports:
- '80:8080'
- '443:8443'
depends_on:
- postgresql
volumes:
postgresql_data:
driver: local
As soon as I rename the service to anything else, it breaks with a "login failed" in the phppgadmin interface with no further information neither on the page nor in the docker compose logs:
version: '2'
services:
foo:
image: docker.io/bitnami/postgresql:11
environment:
- POSTGRESQL_PASSWORD=bitnami
volumes:
- 'postgresql_data:/bitnami'
phppgadmin:
image: docker.io/bitnami/phppgadmin:7
ports:
- '80:8080'
- '443:8443'
depends_on:
- foo
volumes:
postgresql_data:
driver: local
I am using docker-compose down and then docker-compose up to make sure there is no leftover container from a previous run.