Start full container in Docker?

Epeli picture Epeli · Oct 12, 2013 · Viewed 18.2k times · Source

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?

I was expecting that

docker run -t -i ubuntu /sbin/init

would work just like

lxc-start -n ubuntu /sbin/init

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.

Answer

blalor picture blalor · Nov 20, 2013

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.