How to share file or directory with other container on ECS?

淺唱寂寞╮ 提交于 2019-12-12 19:00:42

问题


I have a Sumologic log collector which is a generic log collector. I want the log collector to see logs and a config file from a different container. How do I accomplish this?


回答1:


ECS containers can mount volumes so you would define

{
    "containerDefinitions": [
        {
            "mountPoints": [
              {
                "sourceVolume": "logs",
                "containerPath": "/tmp/clogs/"
              },
        }
    ],
    "volumes": [
        {
            "name": "logs",
        }
    ]
}

ECS also has a nice UI you can click around to set up the volumes at the task definition level, and then the mounts at the container level.

Once that's set up, ECS will mount a volume at the container path, and everything inside that path will be available to all other containers that mount the volume.

Further reading: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_data_volumes.html



来源:https://stackoverflow.com/questions/55929954/how-to-share-file-or-directory-with-other-container-on-ecs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!