I've done a lot of searching but I cannot fix this issue.
I have a basic Rabbitmq container running via this command:
docker run -d --hostname rabbitmqhost --name rabbitmq -p 15672:15672 -p 5672:5672 rabbitmq:3-management
I am using nameko
to create a microservice which connects to this container. Here's a basic microservice module main.py
:
from nameko.rpc import rpc
class Service_Name(object):
name = "service_name"
@rpc
def service_endpoint(self, arg=None):
logging.info('service_one endpoint, arg = %s', arg)
This service runs and connects to the rabbitmq from my host machine with the command:
nameko run main --broker amqp://guest:guest@localhost
I wanted to put the service into a Docker container (called service_one
) but when I do so and run the previous nameko command I get socket.error: [Errno 111] ECONNREFUSED
no matter how I try and link the two containers.
What would be the correct method? The aim is to have each service in a container, all talking to each other through rabbit. Thanks.