[英]How do you add a volume to a container in the IBM Bluemix Docker cloud?
How can you add a data volume to a container ? 如何将数据卷添加到容器? What is the best practice for services with persistent data in Bluemix ? 在Bluemix中具有持久数据的服务的最佳实践是什么?
You can use: 您可以使用:
cf ic volume create VOLNAME
to create a volume and 创建一个体积
cf ic run [IP_address] [-p
PORT] [-P] [-m MEMORY] [-e ENV] [-v
VolumeId:ContainerPath[:ro]] [--name NAME] [--link
NAME:ALIAS] IMAGE [CMD
[CMD ...]]
to attach a volume to a container 将体积连接到容器
More info here: https://www.ng.bluemix.net/docs/containers/doc/container_creating_ov.html#container_creating_ov 此处提供更多信息: https : //www.ng.bluemix.net/docs/containers/doc/container_creating_ov.html#container_creating_ov
and here: https://www.ng.bluemix.net/docs/containers/doc/container_optional.html 和这里: https : //www.ng.bluemix.net/docs/containers/doc/container_optional.html
Regards. 问候。
To answer to your second question "What is the best practice for services with persistent data in Bluemix" since a container is not persistent by design (restarting it will make its state reset), persistent data for a container should be saved on an external docker volume: the data saved on this kind of volume will remain untouched during container start/stop/restart, so become available to the container as soon as it restart successfully. 要回答您的第二个问题“在Bluemix中具有持久性数据的服务的最佳实践是什么”,因为容器不是按设计持久化的(重新启动容器将使其状态重置),那么容器的持久性数据应保存在外部泊坞窗中卷:在容器启动/停止/重新启动过程中,保存在该卷上的数据将保持不变,因此一旦成功重启,容器即可使用该数据。 An example to that could be a DB service like mysql: configuring your mysql instance to save the DB data on the external volume will make the data saved on the database available when restarting the container (if you leave the data saved on default container's filesystem you will lost the data when restarting the container) 例如,像mysql这样的数据库服务:配置mysql实例以将数据库数据保存在外部卷上,将在重新启动容器时使数据库中保存的数据可用(如果将数据保留在默认容器的文件系统上,重新启动容器时将丢失数据)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.