* [Buildroot] [PATCH 1/1] package/docker-engine: add option for static client
@ 2016-10-19 4:10 Christian Stewart
2016-10-19 7:34 ` Thomas Petazzoni
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Christian Stewart @ 2016-10-19 4:10 UTC (permalink / raw)
To: buildroot
Adds an option to selectively enable a static client.
This is useful when bind-mounting the docker client binary into
containers for a docker-in-docker setup.
Signed-off-by: Christian Stewart <christian@paral.in>
---
package/docker-engine/Config.in | 6 ++++++
package/docker-engine/docker-engine.mk | 7 ++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/package/docker-engine/Config.in b/package/docker-engine/Config.in
index b9b9aac..1756977 100644
--- a/package/docker-engine/Config.in
+++ b/package/docker-engine/Config.in
@@ -25,6 +25,12 @@ config BR2_PACKAGE_DOCKER_ENGINE_DAEMON
config BR2_PACKAGE_DOCKER_ENGINE_EXPERIMENTAL
bool "build experimental features"
+config BR2_PACKAGE_DOCKER_ENGINE_STATIC_CLIENT
+ bool "build static client"
+ depends on !BR2_STATIC_LIBS
+ help
+ Build a static docker client.
+
if BR2_PACKAGE_DOCKER_ENGINE_DAEMON
config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS
diff --git a/package/docker-engine/docker-engine.mk b/package/docker-engine/docker-engine.mk
index 3d39aac..b95b9a2 100644
--- a/package/docker-engine/docker-engine.mk
+++ b/package/docker-engine/docker-engine.mk
@@ -25,8 +25,13 @@ DOCKER_ENGINE_GLDFLAGS = \
ifeq ($(BR2_STATIC_LIBS),y)
DOCKER_ENGINE_GLDFLAGS += -extldflags '-static'
+else
+ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_STATIC_CLIENT),y)
+DOCKER_ENGINE_GLDFLAGS_DOCKER += -extldflags '-static'
+endif
endif
+
DOCKER_ENGINE_BUILD_TAGS = cgo exclude_graphdriver_zfs autogen
DOCKER_ENGINE_BUILD_TARGETS = docker
@@ -93,7 +98,7 @@ define DOCKER_ENGINE_BUILD_CMDS
$(HOST_DIR)/usr/bin/go build -v \
-o $(@D)/bin/$(target) \
-tags "$(DOCKER_ENGINE_BUILD_TAGS)" \
- -ldflags "$(DOCKER_ENGINE_GLDFLAGS)" \
+ -ldflags "$(DOCKER_ENGINE_GLDFLAGS) $(DOCKER_ENGINE_GLDFLAGS_$(call UPPERCASE,$(target)))" \
./cmd/$(target)
)
endef
--
2.7.3
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Buildroot] [PATCH 1/1] package/docker-engine: add option for static client
2016-10-19 4:10 [Buildroot] [PATCH 1/1] package/docker-engine: add option for static client Christian Stewart
@ 2016-10-19 7:34 ` Thomas Petazzoni
2016-10-19 7:53 ` Peter Korsgaard
2017-03-07 20:23 ` Thomas Petazzoni
2 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2016-10-19 7:34 UTC (permalink / raw)
To: buildroot
Hello,
On Wed, 19 Oct 2016 00:10:46 -0400, Christian Stewart wrote:
> Adds an option to selectively enable a static client.
>
> This is useful when bind-mounting the docker client binary into
> containers for a docker-in-docker setup.
>
> Signed-off-by: Christian Stewart <christian@paral.in>
We normally don't provide per-package options to build statically.
Indeed, if we were to start doing this, we would have to create one
additional option for every package in Buildroot.
Though, if there's a really serious use-case for having just the docker
client built statically, maybe we can make an exception.
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] package/docker-engine: add option for static client
2016-10-19 4:10 [Buildroot] [PATCH 1/1] package/docker-engine: add option for static client Christian Stewart
2016-10-19 7:34 ` Thomas Petazzoni
@ 2016-10-19 7:53 ` Peter Korsgaard
2016-10-19 20:28 ` Christian Stewart
2017-03-07 20:23 ` Thomas Petazzoni
2 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2016-10-19 7:53 UTC (permalink / raw)
To: buildroot
>>>>> "Christian" == Christian Stewart <christian@paral.in> writes:
> Adds an option to selectively enable a static client.
> This is useful when bind-mounting the docker client binary into
> containers for a docker-in-docker setup.
> Signed-off-by: Christian Stewart <christian@paral.in>
What is the use case for docker-in-docker? Why not bind mount
/var/run/docker.sock instead?
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] package/docker-engine: add option for static client
2016-10-19 7:53 ` Peter Korsgaard
@ 2016-10-19 20:28 ` Christian Stewart
2016-12-23 1:40 ` Christian Stewart
0 siblings, 1 reply; 7+ messages in thread
From: Christian Stewart @ 2016-10-19 20:28 UTC (permalink / raw)
To: buildroot
Hi Peter,
On Wed, Oct 19, 2016 at 3:53 AM, Peter Korsgaard <peter@korsgaard.com> wrote:
> What is the use case for docker-in-docker? Why not bind mount
> /var/run/docker.sock instead?
You need the Docker client if you want to call Docker from bash inside
a container. This is intended for use along with bind mounting the
docker.sock in the container. To guarantee you have the same client
version in the host and the docker container, it's then easier to just
bind mount both docker.sock and the docker client into the container.
You need a static client to make sure this always works. This is why I
added this option and have been using it myself for a long time.
Running Docker inside Docker is actually another thing altogether and
completely possible, and I do this to run an entire Buildroot /
SystemD based system inside Docker:
https://github.com/paralin/SkiffOS/blob/master/docker/Dockerfile
In this way I can compile an entire Skiff (buildroot) system on
Jenkins and run end-to-end tests against a Kubernetes cluster,
orchestrating the Systemd-And-Docker-In-Docker containers over a
cluster of servers.
Best,
Christian Stewart
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] package/docker-engine: add option for static client
2016-10-19 20:28 ` Christian Stewart
@ 2016-12-23 1:40 ` Christian Stewart
0 siblings, 0 replies; 7+ messages in thread
From: Christian Stewart @ 2016-12-23 1:40 UTC (permalink / raw)
To: buildroot
Peter, Thomas,
On Wed, Oct 19, 2016 at 1:28 PM, Christian Stewart <christian@paral.in> wrote:
> On Wed, Oct 19, 2016 at 3:53 AM, Peter Korsgaard <peter@korsgaard.com> wrote:
>> What is the use case for docker-in-docker? Why not bind mount
>> /var/run/docker.sock instead?
>
> You need the Docker client if you want to call Docker from bash inside
> a container. This is intended for use along with bind mounting the
> docker.sock in the container. To guarantee you have the same client
> version in the host and the docker container, it's then easier to just
> bind mount both docker.sock and the docker client into the container.
> You need a static client to make sure this always works. This is why I
> added this option and have been using it myself for a long time.
I'm revisiting this pending patch as I don't think we came to a
conclusion on if it would be merged or not. I'm using the option
extensively in my projects, so I still believe it's worth merging.
Thoughts on this?
Thanks,
Christian Stewart
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] package/docker-engine: add option for static client
2016-10-19 4:10 [Buildroot] [PATCH 1/1] package/docker-engine: add option for static client Christian Stewart
2016-10-19 7:34 ` Thomas Petazzoni
2016-10-19 7:53 ` Peter Korsgaard
@ 2017-03-07 20:23 ` Thomas Petazzoni
2017-03-13 5:22 ` Christian Stewart
2 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2017-03-07 20:23 UTC (permalink / raw)
To: buildroot
Hello,
On Wed, 19 Oct 2016 00:10:46 -0400, Christian Stewart wrote:
> Adds an option to selectively enable a static client.
>
> This is useful when bind-mounting the docker client binary into
> containers for a docker-in-docker setup.
>
> Signed-off-by: Christian Stewart <christian@paral.in>
Since there hasn't been much opposition to your patch, I want to merge
it. Could you however send an updated version that applies to the
latest master, and with an improved commit log and Config.in help text,
based on the justification you gave to Peter?
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] package/docker-engine: add option for static client
2017-03-07 20:23 ` Thomas Petazzoni
@ 2017-03-13 5:22 ` Christian Stewart
0 siblings, 0 replies; 7+ messages in thread
From: Christian Stewart @ 2017-03-13 5:22 UTC (permalink / raw)
To: buildroot
Hi Thomas,
On Tue, Mar 7, 2017 at 3:23 PM, Thomas Petazzoni <
thomas.petazzoni@free-electrons.com> wrote:
>
> Since there hasn't been much opposition to your patch, I want to merge
> it. Could you however send an updated version that applies to the
> latest master, and with an improved commit log and Config.in help text,
> based on the justification you gave to Peter?
>
I had intended to just reply with the patch, but I've been pretty tied up
for the past few days. I plan to finish this later this week.
Best,
Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170313/9f8e30f3/attachment.html>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-03-13 5:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-19 4:10 [Buildroot] [PATCH 1/1] package/docker-engine: add option for static client Christian Stewart
2016-10-19 7:34 ` Thomas Petazzoni
2016-10-19 7:53 ` Peter Korsgaard
2016-10-19 20:28 ` Christian Stewart
2016-12-23 1:40 ` Christian Stewart
2017-03-07 20:23 ` Thomas Petazzoni
2017-03-13 5:22 ` Christian Stewart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox