简体   繁体   English

Bluemix容器 - 如何拥有Linux

[英]Bluemix containers - how have a Linux

I can't start a container on Bluemix with Debian, Centos, Alpine or other. 我无法使用Debian,Centos,Alpine或其他方式在Bluemix上启动容器。 Is there a way or is it blocked? 有办法还是被封锁了?

Image from docker hub. 来自码头工人中心的图片。

Is there any getting started for the run command ? 运行命令有没有开始?

I suppose that i need a file for parameters. 我想我需要一个参数文件。

Big difference between running a container in local docker vs in the container service is that all containers in the container service are effectively running -d (ie daemon/disconncted mode). 在本地docker中运行容器与在容器服务中运行容器之间的最大区别是容器服务中的所有容器都在有效运行-d (即守护进程/断开连接模式)。 If you're just using the base images you listed, most of those do not have a long running process in the container, and expect that you will be running it interactive. 如果您只是使用列出的基本映像,那么大多数映像在容器中没有长时间运行的进程,并且期望您将以交互方式运行它。

Result of that is that in the container service, the container starts, then exits again because it's non-interactive, and there's no other process to keep it alive. 结果是在容器服务中,容器启动,然后再次退出,因为它是非交互式的,并且没有其它进程可以保持它活着。 You can try adding a wait as the "cmd" for it. 您可以尝试添加等待作为“cmd”。

ie for your dockerfile: 即你的dockerfile:

FROM alpine

build that to your registry, then run with something like cf ic run --name alpinetest -m 512 registry.ng.bluemix.net/yourregistryhere/alpine sh -c "sleep 1000000" 构建到你的注册表,然后运行像cf ic run --name alpinetest -m 512 registry.ng.bluemix.net/yourregistryhere/alpine sh -c "sleep 1000000"

Then, to get an interactive shell, you can exec into the container using cf ic exec -ti alpinetest /bin/sh 然后,要获得交互式shell,您可以使用cf ic exec -ti alpinetest /bin/sh容器

Obviously, to have it do something useful, you're probably going to want to put an actual server running in there as the foreground app, and set that as the CMD or ENTRYPOINT, but that'll give you access to it running to poke at. 显然,要让它做一些有用的事情,你可能会想要将一个实际的服务器作为前台应用程序运行在那里,并将其设置为CMD或ENTRYPOINT,但是这会让你访问它运行到戳在。

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

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