Docker Replicas while debugging with Visual Studio not working as expected

Viewed 80

I am debugging a solution that uses docker containers. Its a Visual Studio solution making use of docker-compose to spin up all the required containers.

When spinning up one of each container it works 100%, but the solution is load balanced and I am trying to debug some functionality while there are more than one instance running.

Using docker-compose you can specify replicas and then it will start up more than one instance of that container:

consoledemo:
  image: index.docker.io/dustyroberts/consoledemo:latest
  environment: 
    - ASPNETCORE_ENVIRONMENT=Local
  networks:
    - private_network
  deploy:
    replicas: 10

However, while debugging with Visual Studio Community it causes an error

One or more container names used by this project is already in use. Retrying 'docker-compose up' with non-conflicting container names.

Here is the docker-compose section when debugging the app

  consoledemo:
    image: ${DOCKER_REGISTRY-}consoledemo
    environment: 
      - ASPNETCORE_ENVIRONMENT=Local
    networks:
      - private_network
    deploy:
      replicas: 10

Is it even possible to debug multiple instances of a containerized project using Visual Studio? If so, could someone please point me in the right direction.

0 Answers
Related