Vinicius Andrade
Vinicius Andrade

Reputation: 588

Remove the custom name to scale the service

I have a solution in Visual Studio with Docker support. I'm trying to add a scale property on it to make some tests in our application.

Here is my docker compose file:

version: '3.4'
name: legacy-mongo-campaign-watcher
services:
  application.worker.watcher:
    deploy:
      replicas: 2
    image: ${DOCKER_REGISTRY-}applicationworkerwatcher
    build:
      context: .
      dockerfile: Application/Worker/Application.Worker.Watcher/Dockerfile

When I try to debug the application, the following error appears:

Severity Code Description Project File Line Suppression State
Error DT1001 WARNING: The "application.worker.watcher" service is using the custom container name "Application.Worker.Watcher". Docker requires each container to have a unique name. Remove the custom name to scale the service.
If the error persists, try restarting Docker Desktop. docker-compose C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets 412

Any ideas?

Upvotes: 5

Views: 340

Answers (1)

This appears because docker is trying to create two containers with the same name.

There's a similar issue documented here - https://forums.docker.com/t/problem-with-scale-ing-docker-compose/9193

The fix was to remove the custom name as it requires a unique name and this was causing the duplicate.

Upvotes: 0

Related Questions