
本镜像基于EMQX v4.21版本构建,集成了用于emqx-auth-http插件的自定义仓库,提供高性能MQTT消息服务器功能的同时,支持通过HTTP接口实现灵活的认证与授权逻辑。EMQX作为开源MQTT broker,具备高并发处理能力,而emqx-auth-http插件可与外部HTTP服务集成,实现用户认证与权限控制。
bashdocker run -d --name emqx \ -p 1883:1883 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p 18083:18083 \ emqx:v4.21-custom-auth-http
容器启动后,通过命令行或管理控制台启用插件:
bash# 进入容器 docker exec -it emqx /bin/sh # 启用插件 emqx_ctl plugins load emqx_auth_http
配置文件方式
创建emqx_auth_http.conf配置文件,示例内容:
ini## 认证请求配置 auth.http.auth_req.url = http://your-auth-service/auth auth.http.auth_req.method = post auth.http.auth_req.content_type = application/x-www-form-urlencoded auth.http.auth_req.params = clientid=${clientid},username=${username},password=${password} ## 授权请求配置 auth.http.acl_req.url = http://your-auth-service/acl auth.http.acl_req.method = get auth.http.acl_req.params = clientid=${clientid},username=${username},topic=${topic},action=${action} ## 超时设置 auth.http.timeout = 5000
挂载配置文件启动:
bashdocker run -d --name emqx \ -p 1883:1883 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p 18083:18083 \ -v $(pwd)/emqx_auth_http.conf:/opt/emqx/etc/plugins/emqx_auth_http.conf \ emqx:v4.21-custom-auth-http
环境变量方式
通过环境变量设置核心配置:
bashdocker run -d --name emqx \ -p 1883:1883 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p 18083:18083 \ -e AUTH_HTTP_AUTH_REQ_URL="http://your-auth-service/auth" \ -e AUTH_HTTP_AUTH_REQ_METHOD="post" \ -e AUTH_HTTP_ACL_REQ_URL="http://your-auth-service/acl" \ emqx:v4.21-custom-auth-http
bash# 查看插件状态 docker exec -it emqx emqx_ctl plugins list | grep emqx_auth_http
| 参数 | 描述 | 默认值 |
|---|---|---|
auth.http.auth_req.url | 认证请求URL | - |
auth.http.auth_req.method | 认证请求方法(get/post) | post |
auth.http.auth_req.content_type | 认证请求Content-Type | application/x-www-form-urlencoded |
auth.http.auth_req.params | 认证请求参数模板,支持变量:${clientid},${username},${password} | clientid=${clientid},username=${username},password=${password} |
auth.http.acl_req.url | 授权请求URL | - |
auth.http.acl_req.method | 授权请求方法(get/post) | get |
auth.http.acl_req.params | 授权请求参数模板,支持变量:${clientid},${username},${topic},${action} | clientid=${clientid},username=${username},topic=${topic},action=${action} |
auth.http.timeout | HTTP请求超时时间(毫秒) | 5000 |
auth.http.ssl | 是否启用HTTPS | false |
--network参数配置Docker网络auth.http.ssl = true并配置SSL证书emqx.conf配置文件实现以下是 dufourc1/emqx 相关的常用 Docker 镜像,适用于 不同场景 等不同场景:
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务