Hi everyone,
I was wondering if you could help me with an issue.
I'm trying to connect two containers (in the first one there will be a mqtt subscriber, in the second one the broker) in the same host. I am not sure about how to do it. I just created two dockerfiles, one for each container and than created a docker compose file. Could you help me ? I don't know how to continue
Hi everyone, I was wondering if you could help me with an issue. I'm trying to connect two containers (in the first one there will be a mqtt subscriber, in the second one the broker) in the same host. I am not sure about how to do it. I just created two dockerfiles, one for each container and than created a docker compose file. Could you help me ? I don't know how to continue
Dockerfile Broker: FROM alpine:latest
LABEL Description="MQTT docker image"
RUN apk --no-cache --update add \ mosquitto && \ rm -rf /tmp/ /var/tmp/ /var/cache/apk/*
EXPOSE 1883
ENTRYPOINT ["/usr/sbin/mosquitto"]
Dockerfile Subscriber FROM alpine:latest
RUN apk --no-cache --update add \ mosquitto && \ rm -rf /tmp/ /var/tmp/ /var/cache/apk/* CMD ["subscriber.sh"]
Docker-compose version: "3.12" services: app: build: context: . dockerfile: Dockerfile volumes:
.:/subscriber ports: 1883:1883 image: app:broker container_name: broker_container networks: virtualobjects: ipv4_address: 10.10.10.11
app: build: context: ./subscriber dockerfile: Dockerfile ports:
networks: virtualobjects: driver: bridge name: mynet ipam: driver: default config: