docker - 两个容器之间的共享命名卷在其中一个容器中为空
问题描述
我想在两个容器之间共享一个命名卷,如下所示:
version: '3.5'
services:
service1:
# ...
volumes:
- certificates:/path/to/certificates
service2:
# ...
volumes:
- certificates:/path/to/customcertificates
volumes:
certificates:
一开始,数据只存在于 service1-container 中/path/to/certificates
。使用上面的卷配置,service2中的数据 /path/to/customcertificates
是空的。
如何将这些数据从 service1 共享到 service2?
解决方案
我在写这个问题时找到了解决方案。这不是最佳的,但对我来说还可以。我仍然会发布带有答案的问题,因为我花了一段时间才弄清楚并且可能会帮助某人:
我需要像这样更改卷定义:
volumes:
certificates: {}
推荐阅读
- python - gcp dataproc如何在交互式登录和ssh命令之间使用相同的python
- javascript - 将带有 props 的组件作为 prop 传递给另一个组件
- sql - 透视日期列上的所有时间数据
- python - Pyspark - 从具有数组字段的列表列表创建 DataFrame
- android - Android 视频视图 - 无法播放此视频 - 内部存储
- macos - 如何在新音乐应用 (MacOS Catalina) 中打开 Apple Music (iTunes) 链接
- javascript - AngularJS 未定义
- netsuite - 使用 SuiteScript 2.0 更新 Netsuite 中的自定义地址字段
- stack - stm32f070rbt6 堆栈指针无效地址问题
- docker - 找不到类“Twig_Function”