在Docker开始装满容器? [英] Start full container in Docker?
问题描述
根据这个github问题,应该可以使用Upstart,cron等启动一个完整的容器Docker 0.6或更高版本,但我该怎么做?
According to this github issue it should be possible to start a full container with Upstart, cron etc. with Docker 0.6 or later but how do I do that?
我期待着
docker run -t -i ubuntu /sbin/init
p>
would work just like
lxc-start -n ubuntu /sbin/init
,我会得到一个登录屏幕,但它没有显示任何内容。我也试图使用ssh访问它,但没有运气。我使用Docker索引的默认ubuntu映像。
and I would get a login screen, but instead it displays nothing. I also tried to access it using ssh, but no luck. I'm using the default ubuntu image from Docker index.
推荐答案
docker运行ubuntu / sbin / init
对于0.6.6似乎对我来说完美无瑕。你不会得到登录屏幕,因为Docker只管理进程。相反,您可以使用 docker ps -notrunc
获取完整的lxc容器ID,然后使用 lxc-attach -n< container_id>
在该容器中以root身份运行bash。 sshd没有安装在容器中,所以你不能ssh。
docker run ubuntu /sbin/init
appears to work flawlessly for me with 0.6.6. You won't get a login screen because Docker only manages the process. Instead, you can use docker ps -notrunc
to get the full lxc container ID and then use lxc-attach -n <container_id>
run bash in that container as root. sshd isn't installed in the container, so you can't ssh to it.
这篇关于在Docker开始装满容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!