title: Unable to send message via masstransit Broker unreachable: guest@localhost:5672/
body: <p>I'm new to docker.  I created a .net core 5.0 web api project.</p>
  <p><strong>UPDATE</strong>
  Originally, I was getting the error below on startup.  I'm currently receiving the error when attempting to send my message.</p>
  <p><strong>Goal:</strong> Send message via masstransit</p>
  <p><strong>Error:</strong>
  warn: MassTransit[0]
  Retrying 00:00:08.1220000: Broker unreachable: guest@localhost:5672/
  MassTransit.RabbitMqTransport.RabbitMqConnectionException: Broker unreachable: guest@localhost:5672/
  ---&gt; RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable
  ---&gt; System.AggregateException: One or more errors occurred. (Connection failed)
  ---&gt; RabbitMQ.Client.Exceptions.ConnectFailureException: Connection failed
  ---&gt; System.Net.Sockets.SocketException (111): Connection refused</p>
  <p>I created a <strong>docker-compose</strong> file</p>
  <pre><code>version: '3.4'
  
  networks:
    poc:
  
  services:
    rabbitmq:
      image: masstransit/rabbitmq:latest
      networks:
      - poc
      container_name: rabbitmq
      environment:
          RABBITMQ_ERLANG_COOKIE: ${RABBITMQ_ERLANG_COOKIE}
          RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER}
          RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS}
      ports:
          - 5672:5672
          - 15672:15672
    webapi:
      image: ${DOCKER_REGISTRY-}webapi
      build:
        context: .
        dockerfile: WebApi/Dockerfile
      ports:
          - 5100:80
      
    test:
      image: ${DOCKER_REGISTRY-}test
      build:
        context: .
        dockerfile: Test/Dockerfile
      ports:
          - 5101:80
  </code></pre>
  <p>In my <strong>startup.cs</strong> on the <strong>WebApi</strong> side...</p>
  <pre><code>services.AddMassTransit(mt =&gt;
  {
      mt.UsingRabbitMq((context, cfg) =&gt;
      {
          cfg.AutoStart = true;
          cfg.Host(&quot;rabbitmq&quot;);
          cfg.UseRabbitMqMessageScheduler();
          cfg.ConfigureEndpoints(context);
      });
  });
  </code></pre>
  <p>My <strong>controller</strong></p>
  <pre><code>public class OrderController : Controller
      {
          private readonly IBusControl _bus;
  
          public OrderController(IBusControl bus)
          {
              _bus = bus;
          }
  
          [HttpPost(&quot;api/order&quot;)]
          public async Task&lt;IActionResult&gt; Index([FromBody] Order order)
          {
              try
              {
                  Uri uri = new Uri(&quot;queue:order-queue&quot;);
                  var endpoint = await _bus.GetSendEndpoint(uri);
                  await endpoint.Send(order);
                  return Ok(&quot;Success&quot;);
              }
              catch (Exception exception)
              {
                  return StatusCode(500, exception);
              }
          }
      }
  </code></pre>