* [Buildroot] [PATCH 1/1] package/docker-engine: add disable pivot_root option @ 2019-06-13 20:47 Frank Sigalas 2019-06-13 23:36 ` Christian Stewart 2019-06-14 6:17 ` yann.morin at orange.com 0 siblings, 2 replies; 6+ messages in thread From: Frank Sigalas @ 2019-06-13 20:47 UTC (permalink / raw) To: buildroot Sets the environment variable DOCKER_RAMDISK before starting dockerd. Signed-off-by: Frank Sigalas <frasigal@gmail.com> --- package/docker-engine/Config.in | 5 +++++ package/docker-engine/S60dockerd-ramdisk | 38 ++++++++++++++++++++++++++++++++ package/docker-engine/docker-engine.mk | 8 ++++++- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 package/docker-engine/S60dockerd-ramdisk diff --git a/package/docker-engine/Config.in b/package/docker-engine/Config.in index 1fd229f..5405b3d 100644 --- a/package/docker-engine/Config.in +++ b/package/docker-engine/Config.in @@ -48,6 +48,11 @@ config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS help Build the vfs filesystem driver for Docker. +config BR2_PACKAGE_DOCKER_ENGINE_RAMDISK + bool "disable pivot_root" + help + Disable pivot_root to run docker in ramdisk. + endif comment "docker-engine needs a glibc or musl toolchain w/ threads" diff --git a/package/docker-engine/S60dockerd-ramdisk b/package/docker-engine/S60dockerd-ramdisk new file mode 100644 index 0000000..a1092b6 --- /dev/null +++ b/package/docker-engine/S60dockerd-ramdisk @@ -0,0 +1,38 @@ +#!/bin/sh + +NAME=dockerd +DAEMON=/usr/bin/$NAME +PIDFILE=/var/run/$NAME.pid +DAEMON_ARGS="" + +[ -r /etc/default/$NAME ] && . /etc/default/$NAME $1 + +do_start() { + echo -n "Starting $NAME: " + start-stop-daemon --start --quiet --background --make-pidfile \ + --pidfile $PIDFILE --exec /usr/bin/env DOCKER_RAMDISK=1 $DAEMON -- $DAEMON_ARGS \ + && echo "OK" || echo "FAIL" +} + +do_stop() { + echo -n "Stopping $NAME: " + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + && echo "OK" || echo "FAIL" +} + +case "$1" in + start) + do_start + ;; + stop) + do_stop + ;; + restart) + do_stop + sleep 1 + do_start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac diff --git a/package/docker-engine/docker-engine.mk b/package/docker-engine/docker-engine.mk index 50d4129..d4608fb 100644 --- a/package/docker-engine/docker-engine.mk +++ b/package/docker-engine/docker-engine.mk @@ -51,6 +51,12 @@ else DOCKER_ENGINE_TAGS += exclude_graphdriver_vfs endif +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_RAMDISK),y) +DOCKER_ENGINE_INIT_SCRIPT = S60dockerd-ramdisk +else +DOCKER_ENGINE_INIT_SCRIPT = S60dockerd +endif + DOCKER_ENGINE_INSTALL_BINS = $(notdir $(DOCKER_ENGINE_BUILD_TARGETS)) define DOCKER_ENGINE_RUN_AUTOGEN @@ -74,7 +80,7 @@ define DOCKER_ENGINE_INSTALL_INIT_SYSTEMD endef define DOCKER_ENGINE_INSTALL_INIT_SYSV - $(INSTALL) -D -m 755 package/docker-engine/S60dockerd \ + $(INSTALL) -D -m 755 package/docker-engine/$(DOCKER_ENGINE_INIT_SCRIPT) \ $(TARGET_DIR)/etc/init.d/S60dockerd endef -- 2.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] package/docker-engine: add disable pivot_root option 2019-06-13 20:47 [Buildroot] [PATCH 1/1] package/docker-engine: add disable pivot_root option Frank Sigalas @ 2019-06-13 23:36 ` Christian Stewart 2019-06-14 6:17 ` yann.morin at orange.com 1 sibling, 0 replies; 6+ messages in thread From: Christian Stewart @ 2019-06-13 23:36 UTC (permalink / raw) To: buildroot Hi Frank, On Thu, Jun 13, 2019 at 1:47 PM Frank Sigalas <frasigal@gmail.com> wrote: > Sets the environment variable DOCKER_RAMDISK before starting dockerd. > > Signed-off-by: Frank Sigalas <frasigal@gmail.com> > I have not had a chance to test this yet, but it looks OK at a first scan. I wonder if we should select this automatically in the case that the system is built as a ramdisk and/or linked into the kernel? Best, Christian -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20190613/9b12e6d7/attachment.html> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] package/docker-engine: add disable pivot_root option 2019-06-13 20:47 [Buildroot] [PATCH 1/1] package/docker-engine: add disable pivot_root option Frank Sigalas 2019-06-13 23:36 ` Christian Stewart @ 2019-06-14 6:17 ` yann.morin at orange.com 2019-06-14 7:10 ` Peter Korsgaard 1 sibling, 1 reply; 6+ messages in thread From: yann.morin at orange.com @ 2019-06-14 6:17 UTC (permalink / raw) To: buildroot Frank, All, On 2019-06-13 23:47 +0300, Frank Sigalas spake thusly: > Sets the environment variable DOCKER_RAMDISK before starting dockerd. [--SNIP--] > diff --git a/package/docker-engine/S60dockerd-ramdisk b/package/docker-engine/S60dockerd-ramdisk > new file mode 100644 > index 0000000..a1092b6 > --- /dev/null > +++ b/package/docker-engine/S60dockerd-ramdisk > @@ -0,0 +1,38 @@ > +#!/bin/sh > + > +NAME=dockerd > +DAEMON=/usr/bin/$NAME > +PIDFILE=/var/run/$NAME.pid > +DAEMON_ARGS="" > + > +[ -r /etc/default/$NAME ] && . /etc/default/$NAME $1 The existing package/docker-engine/S60dockerd script also parses similarly named file, so why can't you provide (e.g. in an overlay) this configuraiton file taht would just contain: export DOCKER_RAMDISK=1 The config files in /etc/default/ are the place where such local customisations mustr be done. Besides, your solution does not cover the systemd case anyway (for which Christian alrady provided an example). But that is not even needed either, because this is still a local customisation. Regards, Yann E. MORIN. > +do_start() { > + echo -n "Starting $NAME: " > + start-stop-daemon --start --quiet --background --make-pidfile \ > + --pidfile $PIDFILE --exec /usr/bin/env DOCKER_RAMDISK=1 $DAEMON -- $DAEMON_ARGS \ > + && echo "OK" || echo "FAIL" > +} > + > +do_stop() { > + echo -n "Stopping $NAME: " > + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ > + && echo "OK" || echo "FAIL" > +} > + > +case "$1" in > + start) > + do_start > + ;; > + stop) > + do_stop > + ;; > + restart) > + do_stop > + sleep 1 > + do_start > + ;; > + *) > + echo "Usage: $0 {start|stop|restart}" > + exit 1 > +esac > diff --git a/package/docker-engine/docker-engine.mk b/package/docker-engine/docker-engine.mk > index 50d4129..d4608fb 100644 > --- a/package/docker-engine/docker-engine.mk > +++ b/package/docker-engine/docker-engine.mk > @@ -51,6 +51,12 @@ else > DOCKER_ENGINE_TAGS += exclude_graphdriver_vfs > endif > > +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_RAMDISK),y) > +DOCKER_ENGINE_INIT_SCRIPT = S60dockerd-ramdisk > +else > +DOCKER_ENGINE_INIT_SCRIPT = S60dockerd > +endif > + > DOCKER_ENGINE_INSTALL_BINS = $(notdir $(DOCKER_ENGINE_BUILD_TARGETS)) > > define DOCKER_ENGINE_RUN_AUTOGEN > @@ -74,7 +80,7 @@ define DOCKER_ENGINE_INSTALL_INIT_SYSTEMD > endef > > define DOCKER_ENGINE_INSTALL_INIT_SYSV > - $(INSTALL) -D -m 755 package/docker-engine/S60dockerd \ > + $(INSTALL) -D -m 755 package/docker-engine/$(DOCKER_ENGINE_INIT_SCRIPT) \ > $(TARGET_DIR)/etc/init.d/S60dockerd > endef > > -- > 2.7.4 > > _______________________________________________ > buildroot mailing list > buildroot at busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot -- ____________ .-----------------.--------------------: _ :------------------. | Yann E. MORIN | Real-Time Embedded | __/ ) | /"\ ASCII RIBBON | | +33 534.541.179 | Software Designer | _/ - /' | \ / CAMPAIGN | | +33 638.411.245 '--------------------: (_ `--, | X AGAINST | | yann.morin (at) orange.com |_=" ,--' | / \ HTML MAIL | '--------------------------------------:______/_____:------------------' _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] package/docker-engine: add disable pivot_root option 2019-06-14 6:17 ` yann.morin at orange.com @ 2019-06-14 7:10 ` Peter Korsgaard 2019-06-14 7:22 ` Fragkiskos Sigalas 0 siblings, 1 reply; 6+ messages in thread From: Peter Korsgaard @ 2019-06-14 7:10 UTC (permalink / raw) To: buildroot >>>>> <yann.morin@orange.com> writes: > Frank, All, > On 2019-06-13 23:47 +0300, Frank Sigalas spake thusly: >> Sets the environment variable DOCKER_RAMDISK before starting dockerd. > [--SNIP--] >> diff --git a/package/docker-engine/S60dockerd-ramdisk b/package/docker-engine/S60dockerd-ramdisk >> new file mode 100644 >> index 0000000..a1092b6 >> --- /dev/null >> +++ b/package/docker-engine/S60dockerd-ramdisk >> @@ -0,0 +1,38 @@ >> +#!/bin/sh >> + >> +NAME=dockerd >> +DAEMON=/usr/bin/$NAME >> +PIDFILE=/var/run/$NAME.pid >> +DAEMON_ARGS="" >> + >> +[ -r /etc/default/$NAME ] && . /etc/default/$NAME $1 > The existing package/docker-engine/S60dockerd script also parses > similarly named file, so why can't you provide (e.g. in an overlay) this > configuraiton file taht would just contain: > export DOCKER_RAMDISK=1 > The config files in /etc/default/ are the place where such local > customisations mustr be done. > Besides, your solution does not cover the systemd case anyway (for which > Christian alrady provided an example). But that is not even needed > either, because this is still a local customisation. Yes, I wonder if running dockerd from an initramfs is really such a common setup that we want a dedicated option for it rather than just letting people add such customization in their overlay? -- Bye, Peter Korsgaard ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] package/docker-engine: add disable pivot_root option 2019-06-14 7:10 ` Peter Korsgaard @ 2019-06-14 7:22 ` Fragkiskos Sigalas 2019-06-14 8:36 ` Peter Korsgaard 0 siblings, 1 reply; 6+ messages in thread From: Fragkiskos Sigalas @ 2019-06-14 7:22 UTC (permalink / raw) To: buildroot Yann, All, Your suggestion would work indeed, thank you! Therefore I agree that this patch is not needed. Regards, Frank On Fri, Jun 14, 2019 at 10:10 AM Peter Korsgaard <peter@korsgaard.com> wrote: > >>>>> <yann.morin@orange.com> writes: > > > Frank, All, > > On 2019-06-13 23:47 +0300, Frank Sigalas spake thusly: > >> Sets the environment variable DOCKER_RAMDISK before starting dockerd. > > > [--SNIP--] > >> diff --git a/package/docker-engine/S60dockerd-ramdisk > b/package/docker-engine/S60dockerd-ramdisk > >> new file mode 100644 > >> index 0000000..a1092b6 > >> --- /dev/null > >> +++ b/package/docker-engine/S60dockerd-ramdisk > >> @@ -0,0 +1,38 @@ > >> +#!/bin/sh > >> + > >> +NAME=dockerd > >> +DAEMON=/usr/bin/$NAME > >> +PIDFILE=/var/run/$NAME.pid > >> +DAEMON_ARGS="" > >> + > >> +[ -r /etc/default/$NAME ] && . /etc/default/$NAME $1 > > > The existing package/docker-engine/S60dockerd script also parses > > similarly named file, so why can't you provide (e.g. in an overlay) this > > configuraiton file taht would just contain: > > > export DOCKER_RAMDISK=1 > > > The config files in /etc/default/ are the place where such local > > customisations mustr be done. > > > Besides, your solution does not cover the systemd case anyway (for which > > Christian alrady provided an example). But that is not even needed > > either, because this is still a local customisation. > > Yes, I wonder if running dockerd from an initramfs is really such a > common setup that we want a dedicated option for it rather than just > letting people add such customization in their overlay? > > -- > Bye, Peter Korsgaard > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20190614/3c2ee1ef/attachment.html> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] package/docker-engine: add disable pivot_root option 2019-06-14 7:22 ` Fragkiskos Sigalas @ 2019-06-14 8:36 ` Peter Korsgaard 0 siblings, 0 replies; 6+ messages in thread From: Peter Korsgaard @ 2019-06-14 8:36 UTC (permalink / raw) To: buildroot >>>>> "Fragkiskos" == Fragkiskos Sigalas <frasigal@gmail.com> writes: > Yann, All, > Your suggestion would work indeed, thank you! Therefore I agree that this > patch is not needed. Ok, thanks - I have rejected the patch in patchwork. -- Bye, Peter Korsgaard ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-06-14 8:36 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-06-13 20:47 [Buildroot] [PATCH 1/1] package/docker-engine: add disable pivot_root option Frank Sigalas 2019-06-13 23:36 ` Christian Stewart 2019-06-14 6:17 ` yann.morin at orange.com 2019-06-14 7:10 ` Peter Korsgaard 2019-06-14 7:22 ` Fragkiskos Sigalas 2019-06-14 8:36 ` Peter Korsgaard
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox