You are browsing a read-only backup copy of Wikitech. The live site can be found at

Blubber/User Guide

From Wikitech-static
< Blubber
Revision as of 21:21, 9 January 2019 by imported>Thcipriani (→‎Variants)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

For example use see the Blubber: Getting Started page.

Blubber produces Dockerfiles that can be used to build Docker images. Blubber is written and maintained by the Release Engineering team as part of a toolset for delivering software to testers, developers, testing in CI, and into Wikimedia's production environment. Blubber is part of Wikimedia's Continuous Delivery pipeline.

Blubber reads a higher-level specification written in YAML and produces a Dockerfile on stdout. Docker tooling can use the Blubber produced Dockerfile to build a container image. The image can then be used to run an application container. The image is also suitable for use in a helm chart for deployment to a Kubernetes cluster, for development purposes, or in production. The image can be shared with anyone who wants to run the application on their own, perhaps to test, debug, or develop it.

Blubber runs on its own. Blubber is a statically compiled Go binary. It is not directly connected to WMF infrastructure. Blubber does not run Docker itself.


Blubber specification files use the YAML format. The top level is a map of key/value pairs. The toplevel keys that Blubber knows about are:

Special Config

These are special configuration keys that may only appear once at the toplevel of a Blubberfile.

version (string)
the version of the Blubber specification file syntax; use v3 or Blubber will be very upset indeed.
variants (map)
value should be a map, whose keys name the variants that can be built; see below section about variants for more details

Common Config

These are common configuration keys that may be included as a variant, or they may appear at the toplevel of a Blubberfile.

base (string)
the base image upon which the new Docker image will be built; a list of images can be found by querying the Wikimedia Docker Registry
runs (map)
settings for things run in the container, value should be a dict, which can have the following keys:
environment (map)
a map of environment variables to set, variable is the key, value is the...well...value
insecurely (boolean)
should the application in the container be run as a user that can't write anything to the filesystem, including caches, or as a user that can? Production variants should have this set to `false`, but other variants may set it to `true` in some circumstances.
apt (map)
settings for apt, has, currently, one subkey
packages (sequence)
additional Debian packages to install with the apt command; the value should be a list of package names

Variant Config

Variant configuration keys are typically only seen under a particular variant rather than at the toplevel of a Blubberfile.

node (map)
configuration related to node/npm environment has the following subkeys
requirements (sequence)
list of files that are needed for npm install to work; e.g., [package.json, package-shrinkwrap.json]
env (string)
"production" or another environment. Sets the environment variable NODE_ENV. Will pass npm install --production and run npm dedupe if set to production.
run an arbitrary build command. subkeys:
command (sequence)
command to run as a list, e.g. [make, build]
requirements (sequence)
files to copy to the container for builder to work; e.g., [Makefile]
python (map)
configuration related to installation of pip dependencies. subkeys:
version (string)
version of python to use; e.g., python3
requirements (sequence)
files to copy to the container before running pip; e.g., [requirements.txt]
entrypoint (sequence)
command to run as entrypoint of container image as a list
includes (sequence)
inherit all keys from the variants specified by this sequence. The keys will be combined with this variant's keys subject to specific key merge rules
copies (string)
copy artifacts from on variant to another. Useful for Docker multistage images.

In addition to the keys listed as Variant Config, any of the properties specified in Common Config may specified under the Variant Config.

Config Merge Rules

When a Variant configuration overrides the Common configuration the configurations are merged. The way in which configuration is merged depends on whether the type of the configuration is a compound type; e.g., a map or sequence, or a scalar type; e.g., a string or integer.

In general, configuration that is a compound type is appended, whereas configuration that is of a scalar type is overridden.

For example in this Blubberfile:

version: v3
base: scratch
apt: { packages: [cowsay] }
    base: nodejs
    apt: { packages: [libcaca] }

The base scalar will be overwritten, whereas the apt[packages] sequence will be appended so that both cowsay and libcaca will be installed in an image produced from the Dockerfile resulting from the test Blubberfile variant.


Blubber can build several variants of an image from the same specification file. The variants are named and described under the variants top level item. Typically, there are variants for development versus production: the development variant might have more debugging tools, for example, which are not included in the production variant, which should have no extra software installed to minimize risk of security problems, or other problems.

A variant is built using the top level items, combined with the items for the variant. So if the top level apt installed some packages, and the variant's apt some other packages, both sets of packages get installed in that variant.