当前位置:  开发笔记 > 前端 > 正文

如何将文件复制到停止的docker容器

如何解决《如何将文件复制到停止的docker容器》经验,为你挑选了1个好方法。

我正在docker容器中运行elasticsearch.

在为ssl和shield配置elasticsearch时,我的elasticsearch.yml文件被非法输入,TAB而不是a space.
现在我的docker容器没有启动并出现以下错误:

{1.4.4}: Setup Failed ...
- SettingsException[Failed to load settings from [file:/elasticsearch/config/elasticsearch.yml]]
         IOException[Tabs are illegal in YAML.  Did you mean to use whitespace character instead?]
 org.elasticsearch.common.settings.SettingsException: Failed to load
 settings from [file:/elasticsearch/config/elasticsearch.yml]
         at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromStream(ImmutableSettings.java:947)
         at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromUrl(ImmutableSettings.java:931)
         at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareSettings(InternalSettingsPreparer.java:77)
         at org.elasticsearch.bootstrap.Bootstrap.initialSettings(Bootstrap.java:106)
         at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:177)
         at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
 Caused by: java.io.IOException: Tabs are illegal in YAML.  Did you
 mean to use whitespace character instead?
         at org.elasticsearch.common.settings.loader.YamlSettingsLoader.load(YamlSettingsLoader.java:44)
         at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromStream(ImmutableSettings.java:944)
         ... 5 more

如何elasticsearch.yml在不丢失数据或替换elasticsearch.yml现有容器中的文件的情况下编辑或替换它?



1> BMitch..:

您可以将文件复制出来,然后将其复制回容器(即使容器已停止)docker cp $cont_name:/path/in/container /path/on/host,然后复制出来然后复制出来docker cp /path/on/host $cont_name:/path/in/container.

推荐阅读
ERIK又
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有