{
"containerDefinitions": [
{
...
"mountPoints": [
{
"containerPath": "/etc/prometheus/",
"sourceVolume": "prometheus-config",
"readOnly": false
}
]
}
],
"volumes": [
{
"host": {
"sourcePath": "/path/to/your/prometheus.yml"
},
"name": "prometheus-config"
}
]
}
在这个示例中,我们将主机上的 prometheus 配置文件作为卷挂载到了任务定义的 /etc/prometheus/
目录中。这样,当任务运行时,它会自动加载和使用该配置文件。