Avro Tools Docker镜像围绕Apache Avro Tool构建,集成了Apache Avro 1.7.7版本的工具集。该镜像提供了一系列用于处理Avro数据文件和模式的命令行工具,可在容器环境中便捷地进行Avro数据的创建、解析、转换和元数据管理等操作。
镜像包含以下关键工具(完整工具列表及功能如下):
cat: 从文件中提取样本数据compile: 根据给定模式生成Java代码concat: 不重新压缩的情况下拼接Avro文件fragtojson: 将二进制编码的Avro数据渲染为JSON格式fromjson: 读取JSON记录并写入Avro数据文件fromtext: 将文本文件导入Avro数据文件getmeta: 打印Avro数据文件的元数据getschema: 打印Avro数据文件的模式idl: 从Avro IDL文件生成JSON模式idl2schemata: 从Avro IDL文件提取类型的JSON模式induce: 通过反射从Java类/接口推导模式/协议jsontofrag: 将JSON编码的Avro数据渲染为二进制格式random: 创建包含模式随机生成实例的文件recodec: 更改数据文件的编码方式rpcprotocol: 输出RPC服务的协议rpcreceive: 启动RPC服务器并监听一条消息rpcsend: 发送单条RPC消息tether: 运行 tethered mapreduce作业tojson: 将Avro数据文件以JSON格式输出(每行一条记录或格式化输出)totext: 将Avro数据文件转换为文本文件totrevni: 将Avro数据文件转换为Trevni文件trevni_meta: 将Trevni文件的元数据以JSON格式输出trevni_random: 创建包含模式随机生成实例的Trevni文件trevni_tojson: 将Trevni文件以JSON格式输出通过挂载本地目录到容器的/share目录,实现文件共享。基本命令格式:
bashdocker run --rm -v [本地目录]:/share coderfi/avro-tools [工具名称] [参数]
--rm: 容器退出后自动删除-v [本地目录]:/share: 将本地目录挂载到容器内的/share目录,用于文件读写1. 获取帮助信息
运行以下命令查看所有可用工具及版本信息:
bashdocker run --rm -v `pwd`:/share coderfi/avro-tools
输出示例:
Version 1.7.7 of Apache Avro Copyright 2010 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). C JSON parsing provided by Jansson and written by Petri Lehtinen. The original software is available from http://www.digip.org/jansson/. ---------------- Available tools: cat extracts samples from files compile Generates Java code for the given schema. concat Concatenates avro files without re-compressing. fragtojson Renders a binary-encoded Avro datum as JSON. fromjson Reads JSON records and writes an Avro data file. fromtext Imports a text file into an avro data file. getmeta Prints out the metadata of an Avro data file. getschema Prints out schema of an Avro data file. idl Generates a JSON schema from an Avro IDL file idl2schemata Extract JSON schemata of the types from an Avro IDL file induce Induce schema/protocol from Java class/interface via reflection. jsontofrag Renders a JSON-encoded Avro datum as binary. random Creates a file with randomly generated instances of a schema. recodec Alters the codec of a data file. rpcprotocol Output the protocol of a RPC service rpcreceive Opens an RPC Server and listens for one message. rpcsend Sends a single RPC message. tether Run a tethered mapreduce job. tojson Dumps an Avro data file as JSON, record per line or pretty. totext Converts an Avro data file to a text file. totrevni Converts an Avro data file to a Trevni file. trevni_meta Dumps a Trevni file's metadata as JSON. trevni_random Create a Trevni file filled with random instances of a schema. trevni_tojson Dumps a Trevni file as JSON.
2. 使用idl工具生成JSON模式(输出到STDOUT)
将当前目录下的test.avdl(Avro IDL文件)转换为JSON模式并输出到标准输出:
bashdocker run --rm -v `pwd`:/share coderfi/avro-tools idl test.avdl
输出示例:
json{ "protocol" : "Simple", "namespace" : "org.apache.avro.test", "doc" : "* An example protocol in Avro IDL", ... }
3. 使用idl工具生成JSON模式(输出到文件)
将test.avdl转换为JSON模式并保存到test.avpr文件:
bashdocker run --rm -v `pwd`:/share coderfi/avro-tools idl test.avdl test.avpr
4. 使用idl2schemata工具提取类型模式
从test.avdl中提取所有类型的JSON模式并输出到当前目录:
bashdocker run --rm -v `pwd`:/share coderfi/avro-tools idl2schemata test.avdl
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。




探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 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 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务