command
module
Version:
v0.0.0-...-dfa6242
Opens a new window with list of versions in this module.
Published: Apr 29, 2025
License: MIT
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Dockmon
项目介绍
Dockmon 是一个用 Go 编写的 Docker容器监视器,可以从 Docker 容器中收集日志并存储到 MySQL 数据库中。它支持解析结构化和非结构化日志,监控 Docker 事件以动态收集新启动容器的日志。
功能特性
- 收集指定容器的日志
- 支持结构化和非结构化日志解析
- 监控 Docker 事件,动态收集新启动容器的日志
- 日志存储到 MySQL 数据库,包含容器 ID 和名称
环境要求
- Go 1.22 或更高版本
- Docker
- MySQL
- Redis
安装与使用
本地运行
-
克隆仓库
git clone https://github.com/seakee/dockmon.git
cd dockmon
-
修改配置文件
cp bin/configs/local.json.default bin/configs/local.json
修改 bin/configs/local.json 文件redis、mysql 等配置.system.jwt_secret参数不能为空,建议至少 32 位以上随机字符。
-
初始化数据库
将 bin/data/sql 目录下的 sql 文件导入到 MySQL 数据库
-
编译项目
make build
或者
chmod +x ./scripts/dockmon.sh
./scripts/dockmon.sh build
-
运行程序
make run
或者
./scripts/dockmon.sh run
Docker 运行
构建 Docker 镜像
-
构建 Docker 镜像
make docker-build
或者
chmod +x ./scripts/dockmon.sh
./scripts/dockmon.sh docker-build
运行 Docker 容器
-
运行 Docker 容器
make docker-run
或者
./scripts/dockmon.sh docker-run
或者手动运行 Docker 容器并指定环境变量:
docker run -d --name $(PROJECT_NAME) \
-p 8085:8080 \
-it \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(CONFIG_DIR):/bin/configs \
-v /bin/docker:/bin/docker \
-e APP_NAME=$(PROJECT_NAME) \
$(IMAGE_NAME)
许可证
本项目采用 MIT 许可证。
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.