Docker – Running a Full OS Without Specifying a Command

docker

I'm following the CoreOS Docker Documentation and it mentions starting containers with commands like:

docker run someImageName /bin/somebinary

Where someImageName is an image. When /bin/somebinary exits, the image will no longer be running.

I would simply like to run an image, without specifying any binaries to run. Instead, I simply want to run the services (eg, systemd / sysvinit) that are normally run inside the images OS.

This seems like the most common thing anyone would ever want to do with Docker, but trying to run an image without a command returns:

2014/02/05 14:49:19 Error: create: No command specified

How can I start a Docker container and run a full OS, rather than specifying a command?

Best Answer

As documented here, you simply run /sbin/init as the command just like any other unix booting from single user to multi-user mode.

https://stackoverflow.com/questions/19332662/start-full-container-in-docker

Containers can be full blown OS's, they just don't have to be (neither do VMs for that matter, it's just more complicated to configure and manage).

I would say the whole point of Docker is to make application containers easy, so that you only have to configure an app, not the whole OS.