Mosquitto in portainer

Hi,

I am running HomeAssistant in Docker and Mosquitto for mqtt. It is working fine.
Recently, I added Portainer to my docker environment. As I created my containers with compose.yaml, Portainer does not have full access to those containers.
Most of my containers, I can remove and add the them via portainer “Stacks”.

Mosquitto has a conf-file. How do I add this to portainer (Community Edition 2.16.2 - stand alone)?

Mosquitto compose.yaml

# version: as of January 2023, https://docs.docker.com/compose/compose-file/

services:
  mosquitto:
    image: eclipse-mosquitto:openssl
    container_name: mosquitto
    networks:
      ipvlan70:
        ipv4_address: 192.168.70.4
    volumes:
      - /home/uadmin/Docker/mosquitto/config:/mosquitto/config
      - /home/uadmin/Docker/mosquitto/data:/mosquitto/data
      - /home/uadmin/Docker/mosquitto/log:/mosquitto/log

    restart: unless-stopped
    # mosquitto port specifications: https://test.mosquitto.org/ bzw. https://de.wikipedia.org/wiki/MQTT
    ports:
      - target: 1883
        host_ip: 0.0.0.0
        published: 1883
        mode: host

# Volumes for persisting data
volumes:
  config:
    driver: local
  data:
    driver: local
  log:
    driver: local

# Network specifications
networks:
  ipvlan70:
    external: true

Mosquitto mosquitto.conf

# mosquitto.conf (see man mosquitto.conf(5) https://mosquitto.org/man/mosquitto-conf-5.html

#############################################################################
#
# GENERAL SETTINGS
#
#############################################################################

# Allow for future listeners not related to main one
# per_listener_settings true

#############################################################################
#
# PROTOCOL / TROUGHPUT / PERFORMANCE
#
#############################################################################

# How much memmory we will allocate (MAX)
# 128MB = 134217728 byte
# 256MB = 268435456 byte
memory_limit 268435456

# mqtt v5 max keepalive
max_keepalive 7200

# mqtt v5 max packet
max_packet_size 65535

message_size_limit 65535

# Expire persistent clients that have not appeared for so much time
persistent_client_expiration 3d

#############################################################################
#
# PERSISTENCE
#
#############################################################################

# Should we even save
persistence true

# Where we save stuff
persistence_location /mosquitto/data

# Treat next settings as number of changes (if true) or seconds otherwise
autosave_on_changes true

# How often to save DB
autosave_interval 600

#############################################################################
#
# LOGGING
#
#############################################################################

# Set the format of the log timestamp.
log_timestamp_format %Y-%m-%dT%H:%M:%S

# What to log
log_type error
log_type warning
log_type notice
log_type information

# do not log to file ... we are in docker
log_dest file /mosquitto/log/mosquitto.log

# and stdout
#log_dest stdout



#############################################################################
#
# LISTENERS
#
#############################################################################

# Listen for incoming network connection on the specified port.
listener 1883



#############################################################################
#
# Password File
#
#############################################################################

# Set the path to a password file
password_file /mosquitto/config/pwfile
#allow_anonymous true

EDIT: the current container has this within:

Leave your docker-compose.yml unchanged and copy it to the Portainer’s stack editor. Assuming you are running Portainer on the same host, as you did with docker compose before. Since the filesystem paths did not change, it should work out of the box.

Thanks @m0wlheld,

thanks for your help. This was too easy to believe it would work… :laughing: but it did. :+1:

Chris