如何在ECS上与其他容器共享文件或目录? [英] How to share file or directory with other container on ECS?

查看:182
本文介绍了如何在ECS上与其他容器共享文件或目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Sumologic日志收集器,它是一个通用的日志收集器.我希望日志收集器从其他容器中查看日志和配置文件.我该怎么做?

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?

推荐答案

ECS容器可以装入卷,因此您可以定义

ECS containers can mount volumes so you would define

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

ECS还具有一个不错的UI,您可以单击以在任务定义级别设置卷,然后在容器级别设置挂载.

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.

设置完成后,ECS将在容器路径上安装一个卷,并且该路径内的所有内容将对安装该卷的所有其他容器可用.

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.

进一步阅读: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_data_volumes.html

这篇关于如何在ECS上与其他容器共享文件或目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆