Here is my yaml file. Once I do docker-compose up, I get messages that listen sockets have been opened on these ports. However, if I try to access them by typing “localhost” or “localhost:1883” into the web browser, I dont get back anything. How do I access the service?
If I do curl http://localhost:1883
, It just says no response from server. What am I doing wrong here?
version: '3.5'
services:
mosquitto:
container_name: mosquitto_container1
image: eclipse-mosquitto:latest
restart: always
volumes:
- "./config:/mosquitto/config/:rw"
ports:
- '1883:1883'
- '9001:9001'
- '8883:8883'
- '8083:8083'
tty: true
networks:
- default
Here is my conf file
allow_anonymous true
listener 1883
listener 9001
protocol websockets
listener 8883
cafile /mosquitto/config/certs/ca.crt
certfile /mosquitto/config/certs/broker.crt
keyfile /mosquitto/config/certs/broker.key
listener 8083
protocol websockets
cafile /mosquitto/config/certs/ca.crt
certfile /mosquitto/config/certs/broker.crt
keyfile /mosquitto/config/certs/broker.key
require_certificate false
persistence true
persistence_location /mosquitto/data/
tls_version tlsv1.2