如何扩展现有泊坞窗图像? [英] How to extend an existing docker image?
问题描述
我正在使用官方弹性搜索Docker图片,而不是设置我的自己的弹性搜索实例。而且,这样做很棒,直到我想延长它的时候。我想将奇迹安装到ElasticSearch实例中以获取更多信息。
I'm using the official elasticsearch Docker image instead of setting up my own elastic search instance. And that works great, up to the point when I wanted to extend it. I wanted to install marvel into that ElasticSearch instance to get more information.
现在dockerfile / elasticsearch自动运行ElasticSearch并将命令设置为 / bin / bash
不起作用,附加到容器或尝试通过SSH访问它,也不要使用 apt-get install -y openssh-server
安装ssh-daemon。
Now dockerfile/elasticsearch automatically runs ElasticSearch and setting the command to /bin/bash
doesn't work, neither does attaching to the container or trying to access it over SSH, nor installing ssh-daemon with apt-get install -y openssh-server
.
在这种特殊情况下,我可以进入容器的文件系统并执行 opt / elasticsearch / bint / plugin -i elasticsearch / marvel /最新的
和一切工作。
In this particular case, I could just go into the container's file system and execute opt/elasticsearch/bint/plugin -i elasticsearch/marvel/latest
and everything worked.
但是,如何安装需要安装的附加服务, apt-get
当我不能在运行容器中有终端时
But how could I install an additional service which needs to be installed with apt-get
when I can't have a terminal inside the running container?
推荐答案
只需使用Docker文件以
Simply extend it using a Dockerfile that start with
FROM dockerfile/elasticsearch
并安装marvel或ssh-server或任何您需要的。然后,以正确的命令结束启动您的服务。您可以使用主管启动多种服务,请参阅运行在Docker容器中自动进行服务,以获取更多信息。
and install marvel or ssh-server or whatever you need. Then, end with the correct command to start your services. You can use supervisor to start multple services, see Run a service automatically in a docker container for more info on that.
这篇关于如何扩展现有泊坞窗图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!