Skip to content

chore(compose): drop fixed container_name from postgres service#267

Merged
Weegy merged 2 commits into
mainfrom
chore/docker-drop-postgres-container-name
Jun 8, 2026
Merged

chore(compose): drop fixed container_name from postgres service#267
Weegy merged 2 commits into
mainfrom
chore/docker-drop-postgres-container-name

Conversation

@Weegy

@Weegy Weegy commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

What

Removes the explicit container_name: omadia-postgres from the postgres service in docker-compose.yaml (and corrects the now-stale comment).

Why

The fixed container_name was not needed for the middleware to reach Postgres:

  • Within the compose network, services are resolvable by their service name (postgres), and the service already declares networks.omadia.aliases: [postgres] plus hostname: postgres — so the postgres DNS name resolves regardless of the compose project prefix.
  • A hard-coded container_name also collides when a second compose project (or a parallel stack) runs on the same host, since Docker container names must be globally unique.

Net: less surprising, no behavioural change to service discovery.

Verification

  • docker compose -f docker-compose.yaml config -q ✅ (validates clean)

Weegy added 2 commits June 8, 2026 09:56
The explicit `container_name: omadia-postgres` is redundant for service DNS:
within the compose network the middleware already resolves `postgres` via the
service name and the `networks.omadia.aliases: [postgres]` alias (+ hostname).
A fixed container_name also collides when a second compose project runs on the
same host. Drop it and correct the now-stale comment.
@Weegy Weegy merged commit ef19d47 into main Jun 8, 2026
5 checks passed
@Weegy Weegy deleted the chore/docker-drop-postgres-container-name branch June 8, 2026 08:56
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

Successfully merging this pull request may close these issues.

1 participant