Public | Automated Build

Last pushed: 2 years ago
Short Description
Full Description

Docker Build for Cling (C++ Interpreter)

  • Dockerized build of CERN's Cling.
  • Based on Ubuntu 14.04. (can be changed in the Dockerfile)

<!-- START doctoc generated TOC please keep comment here to allow auto update -->


<!-- END doctoc generated TOC please keep comment here to allow auto update -->


  1. Install docker
  2. Get the image from Docker Hub or build it yourself
  3. Use it like any other docker image

Get the Image from Docker Hub

# get the build from docker hub
docker pull maddouri/cling-ubuntu-docker
# run it ! (the entry point is cling)
docker run -it maddouri/cling-ubuntu-docker

Build It Yourself

# get the Dockerfile
git clone
cd cling-ubuntu-docker
# depending on your machine, this might take a while to finish building
docker build -t my_cling_image .
# run it ! (the entry point is cling)
docker run -it my_cling_image


Defining Aliases

alias cling='docker run -it maddouri/cling-ubuntu-docker'

Accessing the Host's File System

As with any other Docker images, you can access your file system from the container by attaching volumes to it:


docker run -v /path/to/host/folder:/path/to/container/folder -it maddouri/cling-ubuntu-docker

Usage example:

$ ls /media/data/myCode

$ cat func.cpp
#include <iostream>
void sayHi() {
    std::cout << "Hello Dockerized Cling !" << std::endl;

$ docker run -v /media/data/myCode:/code -it maddouri/cling-ubuntu-docker
****************** CLING ******************
* Type C++ code and press enter to run it *
*             Type .q to exit             *
[cling]$ .L /code/func.cpp
[cling]$ sayHi()
Hello Dockerized Cling !
[cling]$ .q
$ # back to the host machine

Using Pipes

# NB: use "-i" instead of "-it" when piping
echo -e '#include <iostream>\n std::cout <<  "Hello Dockerized Cling !" << std::endl;' | docker run -i maddouri/cling-ubuntu-docker

Run Bash in the Container

# use bash as the new entry point
docker run -it --entrypoint=/bin/bash maddouri/cling-ubuntu-docker

Why ?

Due to an issue, I couldn't get a precompiled version of cling for my Ubuntu 16.04 machine, neither did the current sources compile on my platform. (GCC 5 not supported)

Which Version of Cling is Available in the Docker Image ?

When building an image, clones the latest commit available from CERN's repository.

The exact commit SHA1 can be found in the ${CLING_COMMIT_SHA1} file:

docker run -it --entrypoint=/bin/bash maddouri/cling-ubuntu-docker

Automated Builds

After trying both Docker Hub's "Automated Builds" and Travis CI, it turns out that the images can't be built using those services -- in both cases, the build requires more time than the allowed amount.

For this reason, I will be pushing non-automated builds to Docker Hub. (until I figure out a better solution)


The content of the Github repository is available under the 3-Clause BSD license.

However, cling, llvm and clang (i.e. in the built docker image) have different licenses.

IANAL, so if the content of this repository does not comply with a given license, please contact me or create a Github issue in order to fix that :)

Docker Pull Command
Source Repository