Docker Community Forums

Share and learn in the Docker community.

Connecting to mosquitto


#1

Hi guys,

A newbie question…
This is my docker-compose file:

version: '3'
services:  
  mosquitto:
    container_name: eclipse-mosquitto
    image: eclipse-mosquitto
    restart: always   
    ports:
      - '1883:1883'
      - '9001:9001'      
    volumes:
      - mosquittodata:/data
volumes:
  mosquittodata:

When I run it, everything seems to be Ok, but … I cannot connect to the broker from the host computer:

C:\Program Files (x86)\mosquitto>mosquitto_pub -h 127.0.0.1 -t 'test/topic' -m "Hello"
Error: No connection could be made because the target machine actively refused it.

What is wrong? Any ideas?

Thanks,

Alex