-
Notifications
You must be signed in to change notification settings - Fork 18.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run /sbin/init #223
Comments
Docker currently overrides
|
Totally agree, this would be very useful and there is nothing in Docker's design preventing it. Currently this will not work because of the following implementation detail: when starting a new container, docker mint-bounds itself as /sbin/init inside the container, hiding the real /sbin/init and in the proces smaking it unavailable for execution. Once docker-as-init has been executed, the binary can be safely unmounted, un-hiding the real /sbin/init and making it available for execution. The problem is that unmounting must be done from outside the container, which requires cross-namespace synchronization between docker-as-init and dockerd. This can be implemented over a unix socket for example. |
(I'm not sure if it's totally relevant) lxc comes with templates for various distributions, and those templates do heavy hacking of the freshly installed systems to make them runnable in a container (e.g. Debian template and Ubuntu template) So if the filesystem is not "adjusted", users might run into other kind of problems... |
Bringing up an entire system is a use case better served by virtualization. I'm not saying it should be impossible to do with docker, just that it's not the core value prop. Docker seems to be best at process-level isolation, not machine-level. I think encouraging developers to think this way is helpful, and adding complexity/fragility to support full instances seems like a poor tradeoff. lxc is mostly the same and the hacks needed in their full-system templates are evidence of that. |
@vsekhar, I agree. |
I agree also. The fix I propose is the right thing to do anyway - the less On Wed, Mar 27, 2013 at 5:21 PM, Mikhail Sobolev
|
Docker overwrites /sbin/init inside the container for three reasons: 1) set the default gateway route, 2) change the user and 3) clean up |
I don't know if we are ready to drop the |
I feel like we could solve a big part of the problem simply by mounting docker as /sbin/docker-init instead of /sbin/init. Not perfect but should be good enough. Does anybody oppose this? Any negative side-effects I'm not thinking of? |
Might work, but remember that you need to create /sbin/docker-init then. |
Couldn't we just create /sbin/docker-init? Especially if we're going to On Tue, May 28, 2013 at 6:15 PM, Jérôme Petazzoni
|
That works too. Initially the point of bind-mounting init and resolv.conf |
Should be simple enough to scope the bind-mount with a touch/rm in case it On Tue, May 28, 2013 at 6:31 PM, Jérôme Petazzoni
|
I'm not terribly well versed in the issues involved here, but had an idea I wanted to share in case it's useful. What if you check for the existence of /sbin/docker-init first, and if it is there, you use that (so that images prepared specifically with docker in mind can include it and get "upgraded" docker functionality, if you will), but if it isn't, you use /sbin/init (so images that aren't necessarily prepared with docker in mind still work properly). Again, I'm not well versed in the issues, or have much opinion either way, but it was a thought I had so I figured I'd share in case I'm thinking of something useful (but might just be more complex than what is wanted). |
Hey Tianon, what you're describing is indeed very useful, and you can
One thing thing this doesn't allow is telling docker to execute an "entry In any case, those 2 topics are different from what we're discussing - On Tue, May 28, 2013 at 7:59 PM, Tianon Gravi [email protected]:
|
Ah, that makes much more sense. Thanks for clearing that up! :) |
Hey guys, there's a pull request pending to make this possible: #898. It looks like the base images will need some tweaking to boot properly (booting seems to hang on udev-related things for both ubuntu and centos), but I don't expect it to be too hard. |
This has been merged into master, and is scheduled for the 0.6 stable release (target is August 21) |
Ok, this should be in the release now. How do I in practice start the full container in Docker? I've also posted this on Stackoverflow http://stackoverflow.com/questions/19332662/start-full-container-in-docker |
@epeli if you want to start in "machine mode" you can 'docker run /sbin/init' |
hi, @shykes , I start container with : |
You'd have to set the root password and install openssh-server. You probably want to use a Dockerfile or docker run bash then docker commit to get the image setup the way you want/need it before you run |
HI, @tianon , dpkg-divert --local --rename --add /sbin/initctl install openssh-server inside it; cd /etc/init after these steps, I can start ssh server with both " service ssh start" or "/etc/init.d/ssh start" 3). commit the image 5). I can't find ssh server inside container. |
above is the screen snapshot, you can find /sbin/init inside container 8936xxxx |
docker version is 0.6.6 |
|
Hi, @blalor Could you give a detail step about how to use /sbin/init ? thanks! |
@chenyf I'm not sure what you're looking for. I'm using the centos base image so life is apparently easier than dealing with ubuntu. Dockerfile:
Run it: |
you may have a look to our ubuntu based containers |
I'm looking to running squeeze inside a container as a full-blown vps using the tricks above, but I'm having no success. |
Make user/group/uid/gid configurable with docker --build-arg
[18.09 backport] bugfix: fetch the right device number which great than 255
Use image artifacts as daemon and dependencies
This would allow docker to be used to manage containers in full-on instance mode vs. single-use containers.
The text was updated successfully, but these errors were encountered: