Container of the Week – buildpack-deps

If you are like me then you have probably written the following code a lot as the first command in your Dockerfile:
RUN apt-get update && apt-get install git wget

or maybe you need to build a C program to run in your container and use something like this:

RUN apt-get update && \
    apt-get install autoconf automake gcc
It turns out that you can replace both of these scenarios with a base container image from the buildpack-deps library repository.

The purpose of the buildpack-deps images is very simple – install the required packages that are dependencies for a few common development scenarios. These scenarios are:

  • Run “wget” or “curl” to download a shell script from GitHub to run or a vendor binary package to unpack. I’m not a huge fan of either of these but they’re quite a common thing to do.
  • Install “git“, “subversion” or another SCM tool to clone a repository in preparation for working on that repository.
  • Download and install a library for a scripting language such as a Python module from PyPi, or a Gem from Rubygems. This may involve building a C extension with “gcc” or “g++“.

There is a tagged image in the buildpack-deps repository for each of these tasks.

If you’re using Debian Jessie use one of following base containers in your Dockerfile’s FROM line:

  • buildpack-deps:jessie-curl to download scripts or binaries
  • buildpack-deps:jessie-scm to use git, subversion, mercurial or bzr
  • buildpack-deps:jessie to inherit a pre-installed development environment

For the old-school fans of Debian Wheezy, just substitute “wheezy” for “jessie” in the container names above.

Ubuntu users are not left out.  Instead of Jessie you can use base containers from all the currently supported Ubuntu releases.  To do this just use the release name in the tag.

  • trusty
  • xenial
  • yakkety
  • zesty

If you are interested in the contents of any of the buildpack-deps packages, simply browse through the Dockerfile at the buildpack-deps repository page on  the Docker Hub.

Leave a comment

Your email address will not be published. Required fields are marked *