why docker not executing init as lxc why docker not executing init as lxc docker docker

why docker not executing init as lxc


I think that running /sbin/init is just default behaviour in lxc-start, it awaits a command to be run. There is no default command parameter for run command in docker.

You can run init explicitly in docker:

docker run ubuntu /sbin/init

Personally, I like this behaviour - I prefer to use container for my few apss related processes and I do not need init to be started.


The advantage simply is to keep your container light-weight. You decide which processes to run, and no more than that. That way, docker can start a container really really fast.

By the way, you don't depend on supervisord, as you could for instance write a complicated shell script which you put in your command.

One of the applications of docker is to set it up as an executable. E.g. you can make images that run unit or integration tests. Now, you wouldn't want each of those to run several dozens of services that you don't use, right?