我正在寻找一种模式,允许在Kubernetes的同一个pod上运行的两个容器之间共享卷.
我的用例是:我在docker容器中运行了一个Ruby on Rails应用程序.docker镜像包含/app/<app-name>/public
目录中的静态资源,我需要从同一pod中运行的nginx容器访问这些资源.
在"vanilla"docker中,我会用--volumes-from
flag来共享这个目录:
docker run --name app -v /app/<app-dir>/public <app-image>
docker run --volumes-from app nginx
Run Code Online (Sandbox Code Playgroud)
阅读此文档后:https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/volumes.md 我试过这个(只提供相关条目):
spec:
containers:
- image: <app-image>
name: <app-name>
volumeMounts:
- mountPath: /app/<app-name>/public
name: assets
- image: nginx
name: nginx
volumeMounts:
- mountPath: /var/www/html
name: assets
readOnly: true
volumes:
- name: assets
hostPath:
path: /tmp/assets
Run Code Online (Sandbox Code Playgroud)
但:
/tmp/assets
节点存在,它也是空的/app/<app-name>/public
app容器内部也是空的作为一种解决方法,我将尝试在应用程序容器启动时填充共享目录(仅限cp /app/<app-name>/public/*
于共享目录),但我真的不喜欢这个想法.
问题:如何模仿--volumes-from
Kubernetes,或者如果没有直接对应物,我如何将文件从一个容器共享到另一个容器中运行?
apiVersion: v1beta3
Client Version: version.Info{Major:"0", Minor:"17", GitVersion:"v0.17.0", …
Run Code Online (Sandbox Code Playgroud) 我在悬停在fullcalendar项目上时试图显示角带弹出.
我使用eventMouseover/eventMouseout回调来显示/隐藏弹出窗口:
$scope.calendarConfig = {
defaultView: 'basicWeek',
eventMouseover: function(event, jsEvent, view) {
element = $(jsEvent.target).closest('.fc-event');
popover = $popover(element, {placement: 'bottom', contentTemplate: 'calendar-item-popover.html'});
popover.$promise.then(popover.show);
},
eventMouseout: function() {
popover.hide();
popover = null;
}
};
Run Code Online (Sandbox Code Playgroud)
然后我有一个弹出框体模板:
<script type="text/ng-template" id="calendar-item-popover.html">
<p>Event</p>
<p>event: {{event | json}}</p>
</script>
Run Code Online (Sandbox Code Playgroud)
我的问题是如何将'事件'传递给popover范围?
这是吸虫:http://plnkr.co/9c6BDWsYuuWAfI4HnJAH
最近我改编我的rails应用程序在JRuby上运行.我遇到的一个问题是Paperclip.Paperclip使用Cocaine运行ImageMagick等命令行工具,并使用Process.spawn,结果如下:
Errno::ECHILD: No child processes - No child processes waitpid at org/jruby/RubyProcess.java:512 waitpid at org/jruby/RubyProcess.java:497 waitpid at /home/cthulhu/.rvm/gems/jruby-1.6.7.2/gems/cocaine-0.3.0/lib/cocaine/command_line/runners/process_runner.rb:21 call at /home/cthulhu/.rvm/gems/jruby-1.6.7.2/gems/cocaine-0.3.0/lib/cocaine/command_line/runners/process_runner.rb:9 execute at /home/cthulhu/.rvm/gems/jruby-1.6.7.2/gems/cocaine-0.3.0/lib/cocaine/command_line.rb:77 run at /home/cthulhu/.rvm/gems/jruby-1.6.7.2/gems/cocaine-0.3.0/lib/cocaine/command_line.rb:55 run at /home/cthulhu/.rvm/gems/jruby-1.6.7.2/gems/paperclip-3.2.0/lib/paperclip/helpers.rb:29
有没有办法让Paperclip与JRuby顺利合作?我只在linux上运行我的应用程序,所以我不介意使用像ImageMagick这样的Linux本机工具.
Rails 3.2.8,JRuby 1.6.7.2