Message ID | 20171019002257.27646-3-christian@paral.in |
---|---|
State | Superseded |
Headers | show |
Series | [01/12] dumb-init: new package | expand |
Christian, All, On 2017-10-18 20:22 -0400, Christian Stewart spake thusly: > When a docker container is run with the --init flag, the Docker engine > uses the docker-init binary as PID 1 inside the container. This is > necessary in may cases to avoid issues with signal handling, zombie > processes, and other quirks when running as PID 1. > > The docker-init binary is backed by tini on default, but optionally can > be changed to docker-init by user preference. > > Furthermore, this patch fixes the following Docker error: > > dockerd: level=warning msg="failed to retrieve docker-init version" > > Signed-off-by: Christian Stewart <christian@paral.in> > --- > package/docker-engine/Config.in | 26 ++++++++++++++++++++++++++ > package/docker-engine/docker-engine.mk | 11 +++++++++++ > 2 files changed, 37 insertions(+) > > diff --git a/package/docker-engine/Config.in b/package/docker-engine/Config.in > index 05670a716e..7d9a87f7bb 100644 > --- a/package/docker-engine/Config.in > +++ b/package/docker-engine/Config.in > @@ -33,6 +33,32 @@ config BR2_PACKAGE_DOCKER_ENGINE_STATIC_CLIENT > > if BR2_PACKAGE_DOCKER_ENGINE_DAEMON > > +choice > + bool "docker-init to use" > + default BR2_PACKAGE_DOCKER_ENGINE_INIT_TINI > + help > + The docker engine uses a minimal init process as PID 1 > + inside containers. There are several implementations > + of this init process. > + > +config BR2_PACKAGE_DOCKER_ENGINE_INIT_TINI > + bool "tini" > + select BR2_PACKAGE_TINI > + help > + Use Tini as the container init process. > + > + https://github.com/krallin/tini > + > +config BR2_PACKAGE_DOCKER_ENGINE_INIT_DUMB_INIT > + bool "dumb-init" > + select BR2_PACKAGE_DUMB_INIT > + help > + Use dumb-init as the container init process. > + > + https://github.com/Yelp/dumb-init > + > +endchoice > + > config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS > bool "btrfs filesystem driver" > depends on BR2_USE_MMU # btrfs-progs > diff --git a/package/docker-engine/docker-engine.mk b/package/docker-engine/docker-engine.mk > index 8928f072e7..a2776ed78c 100644 > --- a/package/docker-engine/docker-engine.mk > +++ b/package/docker-engine/docker-engine.mk > @@ -50,6 +50,13 @@ endif > ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y) > DOCKER_ENGINE_BUILD_TAGS += daemon > DOCKER_ENGINE_BUILD_TARGETS += dockerd > + > +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_INIT_DUMB_INIT),y) > +DOCKER_ENGINE_INIT = dumb-init > +else > +DOCKER_ENGINE_INIT = tini > +endif > + > endif > > ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_EXPERIMENTAL),y) > @@ -119,6 +126,10 @@ define DOCKER_ENGINE_INSTALL_TARGET_CMDS > $(foreach target,$(DOCKER_ENGINE_BUILD_TARGETS), \ > $(INSTALL) -D -m 0755 $(@D)/bin/$(target) $(TARGET_DIR)/usr/bin/$(target) > ) > + > + $(if $(filter $(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y), \ Why not: $(if $(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),\ ln -fs $(DOCKER_ENGINE_INIT) $(TARGET_DIR)/usr/bin/docker-init ) Regards, Yann E. MORIN. > + ln -fs $(DOCKER_ENGINE_INIT) $(TARGET_DIR)/usr/bin/docker-init > + ) > endef > > $(eval $(generic-package)) > -- > 2.13.6 > > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot
Hello, On Wed, 18 Oct 2017 20:22:48 -0400, Christian Stewart wrote: > When a docker container is run with the --init flag, the Docker engine > uses the docker-init binary as PID 1 inside the container. This is > necessary in may cases to avoid issues with signal handling, zombie > processes, and other quirks when running as PID 1. > > The docker-init binary is backed by tini on default, but optionally can > be changed to docker-init by user preference. Did you meant "dump-init" here instead of "docker-init" ? Thomas
Hi Yann, Thomas, On Sat, Oct 21, 2017, 9:51 AM Yann E. MORIN <yann.morin.1998@free.fr> wrote: > Why not: > > $(if $(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),\ > ln -fs $(DOCKER_ENGINE_INIT) $(TARGET_DIR)/usr/bin/docker-init > ) That would work too. Best, Christian
Hi Thomas,
On Sat, Oct 21, 2017 at 9:51 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Did you meant "dump-init" here instead of "docker-init" ?
No, definitely not.
Best,
Christian
On 24-10-17 05:29, Christian Stewart wrote: > Hi Thomas, > > On Sat, Oct 21, 2017 at 9:51 AM, Thomas Petazzoni > <thomas.petazzoni@free-electrons.com> wrote: >> Did you meant "dump-init" here instead of "docker-init" ? > > No, definitely not. I think you did. You had written The docker-init binary is backed by tini on default, but optionally can be changed to docker-init by user preference. so that would mean that the docker-init binary can be backed by docker-init... Regards, Arnout
Hi Arnout, On Tue, Oct 24, 2017, 5:31 PM Arnout Vandecappelle <arnout@mind.be> wrote: > On 24-10-17 05:29, Christian Stewart wrote: > > On Sat, Oct 21, 2017 at 9:51 AM, Thomas Petazzoni > > <thomas.petazzoni@free-electrons.com> wrote: > >> Did you meant "dump-init" here instead of "docker-init" ? > > > > No, definitely not. > > I think you did. You had written > Definitely not "dump" init. Yes, I did mean dumb-init and just misspelled it the first time. Best, Christian Hi Arnout,<br><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 24, 2017, 5:31 PM Arnout Vandecappelle <<a href="mailto:arnout@mind.be">arnout@mind.be</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> On 24-10-17 05:29, Christian Stewart wrote:<br> > On Sat, Oct 21, 2017 at 9:51 AM, Thomas Petazzoni<br> > <<a href="mailto:thomas.petazzoni@free-electrons.com" target="_blank">thomas.petazzoni@free-electrons.com</a>> wrote:<br> >> Did you meant "dump-init" here instead of "docker-init" ?<br> ><br> > No, definitely not.<br> <br> I think you did. You had written<br></blockquote></div><div><br></div><div>Definitely not "dump" init. Yes, I did mean dumb-init and just misspelled it the first time. </div><div><br></div><div>Best,</div><div>Christian</div>
diff --git a/package/docker-engine/Config.in b/package/docker-engine/Config.in index 05670a716e..7d9a87f7bb 100644 --- a/package/docker-engine/Config.in +++ b/package/docker-engine/Config.in @@ -33,6 +33,32 @@ config BR2_PACKAGE_DOCKER_ENGINE_STATIC_CLIENT if BR2_PACKAGE_DOCKER_ENGINE_DAEMON +choice + bool "docker-init to use" + default BR2_PACKAGE_DOCKER_ENGINE_INIT_TINI + help + The docker engine uses a minimal init process as PID 1 + inside containers. There are several implementations + of this init process. + +config BR2_PACKAGE_DOCKER_ENGINE_INIT_TINI + bool "tini" + select BR2_PACKAGE_TINI + help + Use Tini as the container init process. + + https://github.com/krallin/tini + +config BR2_PACKAGE_DOCKER_ENGINE_INIT_DUMB_INIT + bool "dumb-init" + select BR2_PACKAGE_DUMB_INIT + help + Use dumb-init as the container init process. + + https://github.com/Yelp/dumb-init + +endchoice + config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS bool "btrfs filesystem driver" depends on BR2_USE_MMU # btrfs-progs diff --git a/package/docker-engine/docker-engine.mk b/package/docker-engine/docker-engine.mk index 8928f072e7..a2776ed78c 100644 --- a/package/docker-engine/docker-engine.mk +++ b/package/docker-engine/docker-engine.mk @@ -50,6 +50,13 @@ endif ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y) DOCKER_ENGINE_BUILD_TAGS += daemon DOCKER_ENGINE_BUILD_TARGETS += dockerd + +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_INIT_DUMB_INIT),y) +DOCKER_ENGINE_INIT = dumb-init +else +DOCKER_ENGINE_INIT = tini +endif + endif ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_EXPERIMENTAL),y) @@ -119,6 +126,10 @@ define DOCKER_ENGINE_INSTALL_TARGET_CMDS $(foreach target,$(DOCKER_ENGINE_BUILD_TARGETS), \ $(INSTALL) -D -m 0755 $(@D)/bin/$(target) $(TARGET_DIR)/usr/bin/$(target) ) + + $(if $(filter $(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y), \ + ln -fs $(DOCKER_ENGINE_INIT) $(TARGET_DIR)/usr/bin/docker-init + ) endef $(eval $(generic-package))
When a docker container is run with the --init flag, the Docker engine uses the docker-init binary as PID 1 inside the container. This is necessary in may cases to avoid issues with signal handling, zombie processes, and other quirks when running as PID 1. The docker-init binary is backed by tini on default, but optionally can be changed to docker-init by user preference. Furthermore, this patch fixes the following Docker error: dockerd: level=warning msg="failed to retrieve docker-init version" Signed-off-by: Christian Stewart <christian@paral.in> --- package/docker-engine/Config.in | 26 ++++++++++++++++++++++++++ package/docker-engine/docker-engine.mk | 11 +++++++++++ 2 files changed, 37 insertions(+)