最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

amazon web services - How to share a volume between two containers running in separate ECS tasks (on different Docker hosts)? -

programmeradmin5浏览0评论

I understand that when two Docker containers are running on the same Docker host, they can share a named volume by mounting the same volume in both containers. As mentioned in this answer, the named volume is stored on the host machine (e.g., /var/lib/docker/volumes), making it accessible to both containers.

However, in my case, the two containers are running in separate ECS tasks (Fargate or EC2-backed). Each ECS task is effectively running on a separate Docker host, as defined in this answer:

The docker host is the base traditional OS server where the OS and processes are running in normal (non-container) mode. So the OS and processes you start by actually powering on and booting a server (or VM) are the docker host. The processes that start within containers via docker commands are your containers.

Given that each ECS task has its own Docker host, a local named volume is no longer a viable option for sharing data between these two tasks.

Question: What are the recommended ways to share persistent storage between two containers running in separate ECS tasks? I’m aware that Amazon EFS is commonly used, but are there cases where S3, FSx, or other solutions might be preferable?

The two tasks may be running on different EC2 instances or different AWS-managed infrastructure (Fargate). The storage needs to support read/write access across both tasks.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论