package/docker-engine: add disable pivot_root option
PATCH 1/1 package/docker-engine: add disable pivot_root option
Sets the environment variable DOCKER_RAMDISK before starting dockerd.
--- 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
package/docker-engine/Config.in +5 -0
@@ -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"
package/docker-engine/S60dockerd-ramdisk new file +38 -0
@@ -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
package/docker-engine/docker-engine.mk +7 -1
@@ -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
Signature · 1 line
2.7.4
PATCH 1/1 package/docker-engine: add disable pivot_root option
Hi Frank,
Quoted 4 lines · Frank Sigalas
Sets the environment variable
DOCKER_RAMDISKbefore starting dockerd.Signed-off-by Frank Sigalas <[email protected]>
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>
PATCH 1/1 package/docker-engine: add disable pivot_root option
In reply to Frank SigalasFrank, All,
On 2019-06-13 23:47 +0300, Frank Sigalas spake thusly:
Quoted 1 line
Sets the environment variable
DOCKER_RAMDISKbefore starting dockerd.
[--SNIP--]
Quoted 6 lines
package/docker-engine/S60dockerd-ramdisk new file +0
-0
package/docker-engine/S60dockerd-ramdisk line 8
Quoted 8 lines
package/docker-engine/S60dockerd-ramdisk new file +8
-0@@ -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.
Quoted 62 lines
package/docker-engine/S60dockerd-ramdisk new file +29
-0+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 +esacpackage/docker-engine/docker-engine.mk +7
-1@@ -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 endefSignature · 6 lines
2.7.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 21 lines
____________ .-----------------.--------------------: _ :------------------. | 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.
PATCH 1/1 package/docker-engine: add disable pivot_root option
Quoted 26 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
<[email protected]> writes:
Frank, All,
On 2019-06-13 23:47 +0300, Frank Sigalas spake thusly:Quoted 1 line
Sets the environment variable
DOCKER_RAMDISKbefore starting dockerd.[--SNIP--]
Quoted 6 lines
package/docker-engine/S60dockerd-ramdisk new file +0
-0package/docker-engine/S60dockerd-ramdisk line 8
Quoted 8 lines
package/docker-engine/S60dockerd-ramdisk new file +8
-0@@ -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 $1The 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:
Quoted 8 lines
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?
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 package/docker-engine: add disable pivot_root option
Yann, All,
Your suggestion would work indeed, thank you! Therefore I agree that this patch is not needed.
Regards,
Frank
Quoted 36 lines · Peter Korsgaard
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
<[email protected]> writes:
Frank, All,
On 2019-06-13 23:47 +0300, Frank Sigalas spake thusly:Quoted 1 line
Sets the environment variable
DOCKER_RAMDISKbefore starting dockerd.[--SNIP--]
Review
Quoted 1 line
(quoted diff) +0
-0b/package/docker-engine/S60dockerd-ramdisk
Quoted 18 lines
package/docker-engine/S60dockerd-ramdisk line 8
Quoted 13 lines
new file mode 100644
index 0000000..a1092b6package/docker-engine/S60dockerd-ramdisk new file +8
-0@@ -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 $1The 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:
Quoted 8 lines
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.
Quoted 7 lines
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>
PATCH 1/1 package/docker-engine: add disable pivot_root option
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Fragkiskos" == Fragkiskos Sigalas <[email protected]> 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.
Signature · 1 line
Bye, Peter Korsgaard