简体   繁体   English

等效于运行Bluemix容器的本地主机文件

[英]Equivalent of local host files for running Bluemix containers

When running a docker container locally you can run it with a command like this: 在本地运行Docker容器时,可以使用以下命令运行它:

docker run --name some-nginx -v /some/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx

This will use the file /some/nginx.conf in place of /etc/nginx/nginx.conf within your running docker container. 这将在运行的/etc/nginx/nginx.conf容器中使用文件/some/nginx.conf代替/etc/nginx/nginx.conf This is very handy if you don't want to permanently enshrine your configuration files inside of an image. 如果您不想将配置文件永久包含在映像中,则这非常方便。

However, when running Bluemix containers there is no local filesystem as everything is on a remote host. 但是,在运行Bluemix容器时,由于所有内容都位于远程主机上,所以没有本地文件系统。 Is there an equivalent option available? 是否有可用的等效选项?

Without this it seems like the best options are either to build a dedicated image with your configuration or to put the entire configuration as a user provided service. 没有此选项,似乎最好的选择似乎是使用您的配置来构建专用映像,或者将整个配置作为用户提供的服务。 Is this a correct assumption? 这是正确的假设吗?

You can create a volume and add the configuration files you want to persist on it. 您可以创建一个卷并添加要保留在其上的配置文件。 The volume is not deleted when a container instance is removed and it can be used by multiple containers. 删除容器实例后,该卷不会被删除,并且可以被多个容器使用。

To create a volume you can use the following command: 要创建卷,可以使用以下命令:

$ cf ic volume create my_volume

Then you can create a new container and mount the volume to a path in the container, for example: 然后,您可以创建一个新容器并将该卷安装到容器中的路径,例如:

$ cf ic run -v my_volume:/path/to/mount --name my_container my_image

You can find more details in the following documentation link: 您可以在以下文档链接中找到更多详细信息:

https://console.ng.bluemix.net/docs/containers/container_creating_ov.html#container_volumes_ov https://console.ng.bluemix.net/docs/containers/container_creating_ov.html#container_volumes_ov

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM