专属域名
文档搜索
轩辕助手
Run助手
邀请有礼
返回顶部
快速返回页面顶部
收起
收起工具栏
轩辕镜像 官方专业版
轩辕镜像
专业版
轩辕镜像 官方专业版
轩辕镜像
专业版
首页个人中心搜索镜像

交易
充值流量我的订单
工具
提交工单镜像收录一键安装
Npm 源Pip 源Homebrew 源
帮助
常见问题轩辕镜像免费版
其他
关于我们网站地图
热门搜索:
mosquitto

efrecon/mosquitto

自动构建
efrecon

Easily configurable eclipse MQTT broker

2 次收藏下载次数: 0状态:自动构建维护者:efrecon仓库类型:镜像最近更新:3 天前
轩辕镜像,让镜像更快,让人生更轻。点击查看
镜像简介
标签下载
镜像标签列表与下载命令
轩辕镜像,让镜像更快,让人生更轻。点击查看

mosquitto

These Docker https://hub.docker.com/r/efrecon/mosquitto (also at the https://github.com/efrecon/docker-mosquitto/pkgs/container/mosquitto) behave almost exactly as the official Eclipse mosquitto server https://hub.docker.com/_/eclipse-mosquitto/, while providing easy configuration of most parameters through environment variables. They are also ready for TLS connections using official root certificates out-of-the-box. Finally, whenever relevant files pointed at by the Mosquitto configuration change, this implementation will arrange for mosquitto to reload its configuration to take the changes into account.

Simpler Cases

For all known options present in the default configuration file, it is possible to set their value through creating an environment variable starting with MOSQUITTO_ and continuing with the same name as the option, but in upper case. So, for example, to change the retry interval to 10 seconds, an interval controlled by the configuration option retry_interval, you would set the variable MOSQUITTO_RETRY_INTERVAL to 10.

Sub-Sectioning

This simple heuristic will not work all the time, as Mosquitto divides configuration files into logical sub-sections and several options within these sub-sections share the same name. This image provides a workaround based on the fact that each sub-section is prefixed with a specific comment header in the default configuration file, a file that is made part of the original image upon which this image is based. The implementation is currently able to detect the following sections:

  • default will contain options for the default listener.
  • extra will contain options for an additional listener. There is currently no support for further listeners.
  • persistence will contain options for persistence.
  • logging will contain options for logging.
  • security will contain options for security, authorisations, ACLs, etc.
  • bridges will contain options for bridging mosquitto installations together for improved scalability.

For example, the content of the default section starts with the following header in the file (up to the next header):

configure
# =================================================================
# Default listener
# =================================================================

To start making use of this sectioning of the configuration file, you have to specify an include directory. This can be achieved using a configuration file with a given value for include_dir, or by specifying the environment variable MOSQUITTO_INCLUDE_DIR. Whenever the directory is specified, the main configuration file will be automatically sliced into a number of configuration files, named as described above and created in the include directory. A backup of the original configuration file will be made and a new configuration file where all sub-sections have been removed will be created.

In this context, it becomes possible to use specially crafted environment variables to address options in the different sub-sections. These variables should start with MOSQUITTO__ (note the double underscore), followed by the name of the section (as in the list above) in uppercase, followed by __ (two underscores again), followed by the name of the option in upper case. So, to specify a different port for the default listener, you could for example, set MOSQUITTO_INCLUDE_DIR to /mosquitto/config/sections/ to trigger this mechanism and then set MOSQUITTO__DEFAULT__PORT to 2883.

Note that while logical sections makes it easier to grasp the entire configuration, some of them are not entirely necessary. For example, the persistence section does not seem to have option names that *** with other sections. If you are sure about this, you can set variables directly using "single" underscores. Consequently, there are, for example two ways of turning on persistence:

  • You could set the variable MOSQUITTO_PERSISTENCE to true and set the variable MOSQUITTO_PERSISTENCE_LOCATION to /mosquitto/data/
  • You could also reason with sections and set the variables MOSQUITTO__PERSISTENCE__PERSISTENCE and MOSQUITTO__PERSISTENCE__PERSISTENCE_LOCATION, respectively.

In general, sub-sectioning is more deterministic.

Using from Compose

These images makes configuration much more visible (and flexible) from compose files whenever deploying mosquitto containers. Below is a somewhat constructed example:

yaml
volumes:
  persistence:
    driver: local

services:
  mosquitto:
    image: efrecon/mosquitto:1.5.5
    volumes:
      - persistence:/mosquitto/data
    environment:
      - MOSQUITTO_INCLUDE_DIR=/mosquitto/config/sections/
      - MOSQUITTO__PERSISTENCE__AUTOSAVE_ON_CHANGES=true
      - MOSQUITTO__PERSISTENCE__AUTOSAVE_INTERVAL=100
      - MOSQUITTO__PERSISTENCE__PERSISTENCE=true
      - MOSQUITTO__PERSISTENCE__PERSISTENCE_LOCATION=/mosquitto/data/
      - MOSQUITTO__LOGGING__LOG_DEST=stderr
    ports:
      -
        target: 1883
        published: 1883
        protocol: tcp
        mode: host
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "10"
    deploy:
      restart_policy:
        delay: 10s
        max_attempts: 10
        window: 60s
      replicas: 1

Jumping into the container with docker exec would show a modified version of the regular configuration file at /mosquitto/config/mosquitto.conf and several configuration files in the directory /mosquitto/config/sections/, one for each of the sections supported by this implementation.

Complex Cases

For even more complex cases, you will have to provide your own configuration file by hand. If this is the case, there is probably little point in preferring this image over the official Eclipse image. However, you might still want to mix behaviours. As long as you provide a configuration that contains the same sections (in comments) as the original configuration file, you should be able to benefit from this implementation. Note that the entrypoint requires the file to be located at /mosquitto/config/mosquitto.conf.

Security

Secrets

For security reasons, you would probably not want to expose the value of secrets using environment variables. A possible workaround is to copy the default configuration file inside your own project, modify sensitive data in the file and mount it/copy it into the container. As long as your copy keeps track of all possible options and their default values as lines that are commented away, you would still be able to tune the configuration externally as explained in the previous paragraph. Note that most secret information in mosquitto is offloaded to other files than the main configuration file, so in most cases you will be safe to point at these files through environment variables; while still making sure that the files containing secret information are present within the container.

TLS

In order to provide TLS encryption, you will have to add an extra listener to mosquitto. Provided you have official key and cert for a host, you could place them in a volume (tls in the example below) and adapt the following compose file:

yaml
volumes:
  persistence:
    driver: local
  tls:
    driver: local

services:
  mosquitto:
    image: efrecon/mosquitto:1.5.5
    volumes:
      - persistence:/mosquitto/data
      - tls:/mosquitto/config/security
    environment:
      - MOSQUITTO_INCLUDE_DIR=/mosquitto/config/sections/
      - MOSQUITTO__PERSISTENCE__AUTOSAVE_ON_CHANGES=true
      - MOSQUITTO__PERSISTENCE__AUTOSAVE_INTERVAL=100
      - MOSQUITTO__PERSISTENCE__PERSISTENCE=true
      - MOSQUITTO__PERSISTENCE__PERSISTENCE_LOCATION=/mosquitto/data/
      - MOSQUITTO__LOGGING__LOG_DEST=stderr
      - MOSQUITTO__EXTRA__LISTENER=8883
      - MOSQUITTO__EXTRA__CAPATH=/etc/ssl/certs/
      - MOSQUITTO__EXTRA__KEYFILE=/mosquitto/config/security/yourhostname.key
      - MOSQUITTO__EXTRA__CERTFILE=/mosquitto/config/security/yourhostname.crt
    ports:
      -
        target: 8883
        published: 8883
        protocol: tcp
        mode: host
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "10"
    deploy:
      restart_policy:
        delay: 10s
        max_attempts: 10
        window: 60s
      replicas: 1

This can be combined with an auto-renewing reverse proxy such as caddy to protect access to your mosquitto container using certificates from Let's Encrypt. You will then have to share the volume where caddy stores handshaked certificates with your mosquitto container and adapt the path to access the key and certificate.

Configuring the Entrypoint

The entrypoint itself can be configured either by command-line options, or through environment variables, all starting with MQ_. Command-line options have precedence over environment variables. The image default is to provide feedback about the transformations applied by this implementation through setting the --verbose flag.

Reloading

When running with sectioning, which is triggered by setting the environment variable MOSQUITTO_INCLUDE_DIR or setting the configuration parameter include_dir, this implementation is able to detect changes in files that are pointed at by the configuration, e.g. password file, server certificate or key, etc. This is controlled by the command-line option --watcher to the entrypoint (or the environment variable MQ_WATCHER); a good default that should work in most cases is provided.

The implementation will look into the sectioned configuration files for the values of known configuration parameters and, for each, start a process that will watch the file pointed at by the parameter for changes. When the file changes, the SIGHUP process is sent to mosquitto, which will then reload its configuration (see section about signals in the manual).

File watching is implemented using watch.sh, signalling using signal.sh. The signalling implementation will actively look for a probable process if the PID file does not exist.

Automated Builds

Builds will happen automatically for all current and future versions of the official https://hub.docker.com/r/efrecon/mosquitto by the way of the scripts in the https://github.com/efrecon/docker-mosquitto/tree/master/hooks directory. This means that versioning and tagging of these images will match the official Docker library. Currently, version discovery is based on https://github.com/efrecon/reg-tags, a shell library present as a submodule to this repository.

Implementation

All substitution and slicing occurs from https://github.com/efrecon/docker-mosquitto/blob/master/docker-entrypoint.sh. Substitution in the various configuration files occurs at the shell level. Slicing the main configuration file into sub-sections required a more complex algorithm and is implemented in the Tcl script https://github.com/efrecon/docker-mosquitto/blob/master/slicer.tcl. The script is called twice, once for detecting the location of the include directory, and a second time to create the various sub-section files.

Configuration of the entrypoint can occur through environment variables starting with MQ_. The value of these variables is also used in the processes that are started from the entrypoint to watch relevant files for changes. The entire process tree forming the implementation is placed under the control of https://github.com/krallin/tini to ease garbage collection of processes when containers are killed or stopped.

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

轩辕镜像加速拉取命令点我查看更多 mosquitto 镜像标签

docker pull docker.xuanyuan.run/efrecon/mosquitto:<标签>

使用方法:

  • 登录认证方式
  • 免认证方式

DockerHub 原生拉取命令

docker pull efrecon/mosquitto:<标签>

更多 mosquitto 镜像推荐

eclipse/mosquitto logo

eclipse/mosquitto

eclipse
DEPRECATED REPOSITORY: CONSIDER USING https://hub.docker.com/_/eclipse-mosquitto
11 次收藏10万+ 次下载
9 年前更新
eclipse-mosquitto logo

library/eclipse-mosquitto

Docker 官方镜像
Eclipse Mosquitto是一款开源的消息代理软件,它全面实现了MQTT协议的5.0版、3.1.1版及3.1版标准,作为轻量级发布/订阅消息传输协议的关键组件,该消息代理能够高效接收、存储并转发来自各类客户端的消息,广泛适用于物联网设备通信、移动应用数据交互及分布式系统集成等场景,凭借其开源特性、轻量化设计与良好的协议兼容性,成为开发者构建可靠消息传递系统的优选工具。
1.4千 次收藏5亿+ 次下载
15 天前更新
vimagick/mosquitto logo

vimagick/mosquitto

vimagick
开源的MQTT消息代理,实现MQ遥测传输协议v3.1和v3.1.1,支持消息发布/订阅模式,适用于物联网设备通信和实时数据传输。
8 次收藏50万+ 次下载
2 年前更新
telefonicaiot/mosquitto logo

telefonicaiot/mosquitto

telefonicaiot
基于mosquitto的MQTT broker容器,用于帮助用户进行MQTT测试,是仓库中的辅助材料。
1万+ 次下载
14 天前更新
crossarch/mosquitto logo

crossarch/mosquitto

crossarch
Crossarch Mosquitto images
1 次收藏3.4千+ 次下载
5 年前更新
thinxcloud/mosquitto logo

thinxcloud/mosquitto

thinxcloud
暂无描述
5万+ 次下载
5 个月前更新

查看更多 mosquitto 相关镜像

轩辕镜像配置手册

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式

Docker 配置

登录仓库拉取

通过 Docker 登录认证访问私有仓库

专属域名拉取

无需登录使用专属域名

K8s Containerd

Kubernetes 集群配置 Containerd

K3s

K3s 轻量级 Kubernetes 镜像加速

Dev Containers

VS Code Dev Containers 配置

Podman

Podman 容器引擎配置

Singularity/Apptainer

HPC 科学计算容器配置

其他仓库配置

ghcr、Quay、nvcr 等镜像仓库

Harbor 镜像源配置

Harbor Proxy Repository 对接专属域名

Portainer 镜像源配置

Portainer Registries 加速拉取

Nexus 镜像源配置

Nexus3 Docker Proxy 内网缓存

系统配置

Linux

在 Linux 系统配置镜像服务

Windows/Mac

在 Docker Desktop 配置镜像

MacOS OrbStack

MacOS OrbStack 容器配置

Docker Compose

Docker Compose 项目配置

NAS 设备

群晖

Synology 群晖 NAS 配置

飞牛

飞牛 fnOS 系统配置镜像

绿联

绿联 NAS 系统配置镜像

威联通

QNAP 威联通 NAS 配置

极空间

极空间 NAS 系统配置服务

网络设备

爱快路由

爱快 iKuai 路由系统配置

宝塔面板

在宝塔面板一键配置镜像

需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单

镜像拉取常见问题

使用与功能问题

配置了专属域名后,docker search 为什么会报错?

docker search 限制

Docker Hub 上有的镜像,为什么在轩辕镜像网站搜不到?

站内搜不到镜像

机器不能直连外网时,怎么用 docker save / load 迁镜像?

离线 save/load

docker pull 拉插件报错(plugin v1+json)怎么办?

插件要用 plugin install

WSL 里 Docker 拉镜像特别慢,怎么排查和优化?

WSL 拉取慢

轩辕镜像安全吗?如何用 digest 校验镜像没被篡改?

安全与 digest

第一次用轩辕镜像拉 Docker 镜像,要怎么登录和配置?

新手拉取配置

轩辕镜像合规吗?轩辕镜像的合规是怎么做的?

镜像合规机制

错误码与失败问题

docker pull 提示 manifest unknown 怎么办?

manifest unknown

docker pull 提示 no matching manifest 怎么办?

no matching manifest(架构)

镜像已拉取完成,却提示 invalid tar header 或 failed to register layer 怎么办?

invalid tar header(解压)

Docker pull 时 HTTPS / TLS 证书验证失败怎么办?

TLS 证书失败

Docker pull 时 DNS 解析超时或连不上仓库怎么办?

DNS 超时

docker 无法连接轩辕镜像域名怎么办?

域名连通性排查

Docker 拉取出现 410 Gone 怎么办?

410 Gone 排查

出现 402 或「流量用尽」提示怎么办?

402 与流量用尽

Docker 拉取提示 UNAUTHORIZED(401)怎么办?

401 认证失败

遇到 429 Too Many Requests(请求太频繁)怎么办?

429 限流

docker login 提示 Cannot autolaunch D-Bus,还算登录成功吗?

D-Bus 凭证提示

为什么会出现「单层超过 20GB」或 413,无法加速拉取?

413 与超大单层

账号 / 计费 / 权限

轩辕镜像免费版和专业版有什么区别?

免费版与专业版区别

轩辕镜像支持哪些 Docker 镜像仓库?

支持的镜像仓库

镜像拉取失败还会不会扣流量?

失败是否计费

麒麟 V10 / 统信 UOS 提示 KYSEC 权限不够怎么办?

KYSEC 拦截脚本

如何在轩辕镜像申请开具发票?

申请开票

怎么修改轩辕镜像的网站登录和仓库登录密码?

修改登录密码

如何注销轩辕镜像账户?要注意什么?

注销账户

配置与原理类

写了 registry-mirrors,为什么还是走官方或仍然报错?

mirrors 不生效

怎么用 docker tag 去掉镜像名里的轩辕域名前缀?

去掉域名前缀

如何拉取指定 CPU 架构的镜像(如 ARM64、AMD64)?

指定架构拉取

用轩辕镜像拉镜像时快时慢,常见原因有哪些?

拉取速度原因

查看全部问题→

用户好评

来自真实用户的反馈,见证轩辕镜像的优质服务

用户头像

oldzhang

运维工程师

Linux服务器

5

"Docker访问体验非常流畅,大镜像也能快速完成下载。"

轩辕镜像
镜像详情
...
efrecon/mosquitto
博客Docker 镜像公告与技术博客
热门查看热门 Docker 镜像推荐
安装一键安装 Docker 并配置镜像源
镜像拉取问题咨询请 提交工单,官方技术交流群:1072982923。轩辕镜像所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
镜像拉取问题咨询请提交工单,官方技术交流群:。轩辕镜像所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
商务合作:点击复制邮箱
©2024-2026 源码跳动
商务合作:点击复制邮箱Copyright © 2024-2026 杭州源码跳动科技有限公司. All rights reserved.