DocsPipelines for ApplicationsDocker
Creating a Docker build image

Create Docker build image


With Pipelines for Applications builds you can build on one of the many existing Pipelines shared build images. These images include:

  • Pipelines Android
  • Pipelines Base
  • Pipelines Go
  • Pipelines Haskell
  • Pipelines Java/JVM
  • Pipelines Javascript
  • Pipelines Legacy
  • Pipelines PHP
  • Pipelines Perl
  • Pipelines Python
  • Pipelines Ruby

For more information on these build images, see Pipelines Build Environments.

Important: The Pipelines build servers use the IP addresses housed in this GitHub repostory.

If your organization requires a whitelist of IP adresses, such as for a firewall, we strongly recommend watching this repository for changes.

If whitelisting IP addresses isn’t an option, see our documentation on setting up your own build servers.

You can further enhance this list with your own custom-built Docker images. To add a custom-built image to the shared image list, you create a Docker Dockerfile and build it with Pipelines for Applications. Navigate to the completed Docker image details page in the Pipelines web UI and mark that image as a build image.

Image requirements

  • The Docker image should be based on a flavor of Linux.
  • The Docker image should have the following tools installed:
    • /bin/sh - Specifically, this must work: docker run /bin/sh
    • bash on PATH - If not, Pipelines will attempt to install it.
    • curl on PATH - If not, Pipelines will attempt to install it.
    • gosu on PATH - If not, Pipelines will attempt to install it.
    • useradd on PATH - If not, Pipelines will attempt to install it.
    • distelli on PATH - If not, Pipelines will attempt to install it.
    • sudo on PATH - If not, Pipelines will attempt to install it.

Example Dockerfile

The following Dockerfile exemplifies creating a Docker image for building nodejs applications in Docker. Please note the comments inline.

# Ubuntu has the necessary framework to start from
FROM ubuntu:14.04

# Run as root
USER root

# Create Distelli user
RUN useradd -ms /bin/bash distelli 

# Set /home/distelli as the working directory
WORKDIR /home/distelli
# Install prerequisites. This provides me with the essential tools for building with.
# Note. You don't need git or mercurial.
RUN sudo apt-get update -y \
    && sudo apt-get -y install build-essential checkinstall git mercurial \
    && sudo apt-get -y install libssl-dev openssh-client openssh-server \
    && sudo apt-get -y install curl apt-transport-https ca-certificates

# Update the .ssh/known_hosts file:
RUN sudo sh -c "ssh-keyscan -H >> /etc/ssh/ssh_known_hosts"

# Install Distelli CLI to coordinate the build in the container
RUN curl -sSL | sh 

# Install Docker
# Note. This is necessary only if you plan on building Docker images
RUN sudo apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D \
    && sudo sh -c "echo 'deb ubuntu-trusty main' > /etc/apt/sources.list.d/docker.list" \
    && sudo apt-get update -y \
    && sudo apt-get purge -y lxc-docker \
    && sudo apt-get -y install docker-engine \
    && sudo sh -c 'curl -L`uname -s`-`uname -m` > /usr/local/bin/docker-compose' \
    && sudo chmod +x /usr/local/bin/docker-compose \
    && sudo docker -v

# Setup a volume for writing Docker layers/images
VOLUME /var/lib/docker

# Install gosu
RUN sudo curl -o /bin/gosu -sSL "$(dpkg --print-architecture)" \
     && sudo chmod +x /bin/gosu

# Install node version manager as distelli user
USER distelli
RUN curl -o- | bash 

# Ensure the final USER statement is "USER root"
USER root

# An informative file I like to put on my shared images
RUN sudo sh -c "echo 'Distelli Build Image maintained by Brian McGehee' >> /"

# The following entry point is not necessary
CMD ["/bin/bash"]

Create application

You will need to create an application for creating your custom build image. This application will be created in a software repository and added to Pipelines as an application.

  1. Create a new repository with the above Dockerfile in it.
  2. Add the following distelli-manifest.yml to this repository.

    - echo "--Creating Docker Image--"
    - docker build --quiet=false -t "$DISTELLI_DOCKER_REPO" "$DISTELLI_DOCKER_PATH"
    - echo "--Pushing Docker Image--"
  1. Replace the following fields:
  • DISTELLI_USERNAME - Your Pipelines username.
  • APP_NAME - The name of the repository or app name in Pipeines for Applications.

my example repo

You can fork my repository at

  1. Add this repository to a new Pipelines application. For more information on creating applications, see Creating an Application.

    While creating your new application, ensure you configure a Docker registry to store your build image. For more information see Enabling Docker for New Applications or see Enabling Docker for Existing Applications.

my example app

The above image shows my example application. Each of my successful builds creates a Docker image that is placed in the Docker repository.

Set Build Image

After a successful build of the Docker container, there will be an Image event in Pipelines. Clicking on this will take you to the image details page.

Click the image

In the image details page, click the Build Image switch at the top right.

Build image

You are now ready to use your new custom build image to build Pipelines applications.

Using custom Docker images to build in Pipelines

Any Pipelines application that wishes to build with this new custom Docker build image can do so. This option is branch-specific.

  1. Navigate to the application in the Pipelines web UI.
  2. Select the branch you wish to build with the custom Docker image.

Select branch

  1. Click the Build Options gear.

Build options

You can now select to build in your custom container.

How helpful was this page?
Puppet sites use proprietary and third-party cookies. By using our sites, you agree to our cookie policy.