# docker-agent **Repository Path**: os-lee/docker-agent ## Basic Information - **Project Name**: docker-agent - **Description**: docker-agent功能: 1. 打印docker-agent版本信息 2. 运行容器 验证容器参数 获取环境变量的镜像仓库信息并登录 检查容器是否重复,删除旧容器 运行新容器,拉取新镜像,限制cpu,内存,文件句柄 清理宿主机上没有运行的镜像 返回运行结果 3. 日志采集 - **Primary Language**: Go - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-21 - **Last Updated**: 2025-04-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 介绍 ```` docker-agent功能: 1. 打印docker-agent版本信息 2. 运行容器 验证容器参数 获取环境变量的镜像仓库信息并登录 检查容器是否重复,删除旧容器 运行新容器,拉取新镜像,限制cpu,内存,文件句柄 清理宿主机上没有运行的镜像 返回运行结果 3. 日志采集 采集时间精确到毫秒 新的日志消息以时间戳开头 如果一直没有新日志,5秒后提交最后一条 从nacos自动发现服务采集 提供一个接口,查看现在正在采集的服务及地址 ```` ## 使用 ```` 1. 运行 使用docker-compose 2. 接口调用 // docker login -u cn-southwest-2@VEHN7D0TJ9316H8AHCAV -p 025bd8f0eaf1e0a1b6c9ca9ee5c27bd489cb2b68f83a5e320520fff4e8bd71c4 https://swr.cn-southwest-2.myhuaweicloud.com curl -X POST -H "Content-Type: application/json" -H "X-API-Key: uOyKfp20pdM3MFhr3KAQBoe1UHCaZLUeeLephB57MPvGXTY05Eis5eaxta6fEtpa" -d '{ "container_name": "test-container", "image_version": "swr.cn-southwest-2.myhuaweicloud.com/wd/nginx:1.27-alpine3.20", "ports": ["8080:80"], "mount_infos": ["/etc/localtime:/etc/localtime:ro"], "cpu_count": 0.5, "memory_limit": "512m", "ulimit": "nofile=65535:65535" }' http://127.0.0.1:10080/start-container curl -X POST -H "Content-Type: application/json" -H "X-API-Key: uOyKfp20pdM3MFhr3KAQBoe1UHCaZLUeeLephB57MPvGXTY05Eis5eaxta6fEtpa" -d '{ "container_name": "test-container", "image_version": "nginx:latest", "ports": ["8080:80"], "mount_infos": ["/etc/localtime:/etc/localtime:ro"], "cpu_count": 0.5, "memory_limit": "512m", "ulimit": "nofile=65535:65535" }' http://sasac-rc.com:20608/docker-agent/start-container ````