Skip to content

Validation doesn't catch multiple services with the same container_name #583

@maxsokolovsky

Description

@maxsokolovsky

The following configuration declares two services, each of which has the container_name specified.
But those container names are the same.

version: '3.4'
services:
  webservice1:
    container_name: foo
    image: nginx
  webservice2:
    container_name: foo
    image: nginx

I can run docker compose up with the above configuration.
But there will be an error at runtime from Docker,
so one of the two containers will not start.

Why doesn't compose validate this and issue an error before running any containers?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions