You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use two techniques:
1) the use of a minimal docker base (FROM scratch + busybox)
2) the use of a static binary
... to create a minimally sized image for 'peer' and 'orderer'
Before this patch, these containers are approximately 1.4GB. After this
patch, they are about 20MB-24MB.
It isn't strictly necessary to include busybox. The main benefit
is achieved simply by eliminating external dependencies in the
golang binary using -static and then getting rid of all the
bloat in the baseimage via "FROM scratch". However, in this mode
the image is pathologically bare-boned. For instance, the image has
to be launched using the exec-form '["peer", "node", "start"]' since
there is no shell interpreter available to do the more natural
"CMD peer node start". Further, any "docker exec" style debugging
would be impossible. It is often helpful to jump into a container
and poke around with tools like ifconfig, ping, netstat, etc.
Enter busybox: We can create a basic unix environment with only
a 5MB payload. This is impressive and is easily worth its weight
in the image.
However, the challenge isn't really justifying the utility of having
busybox over saving 5MB as much as it is about how we will get it
into the image. If the world were a monochrome x86_64, we could simply
s/FROM scratch/FROM busybox and be done. However, we have to consider
other multi $arch. To support this, we forgo the temptation to use
FROM busybox and build busybox from source. On my 2011 Macbook Pro,
this adds about 5 minutes to the build, at least on the first build.
Subsequent builds utilize the cache in ./build and thus are no-ops.
This is _just_ fast enough that I am not embarrassed to propose it
for consideration. However, if this is perceived as a problem
we do have alternatives. For instance, we could start distributing
a multi-$arch busybox base (hyperledger/fabric-busybox:$arch), TBD.
Change-Id: I4ed20a429c2cc2e72fd602b45c5c8dd5548bc995
Signed-off-by: Greg Haskins <[email protected]>
0 commit comments