Public | Automated Build

Last pushed: 3 years ago
Short Description
This is a Docker image for Apache Thrift. It contains all the necessary artifacts for supporting C, C++, Java and Python languages.
Full Description


This image may be used for extending the user's development enviornment with a Thrift compiler without a need to install anything on her/his machine. Moreover, all the libraries required for server and client side components are inside the image. These may be retrieved by using the Docker's cp command.

By default, the following languages are supported in this image version: C, C++, Java and Python. Other languages may be added as documented in the Thrift's on-line documentation. You may either extend this image or fork the project and create an alternate version.


To use the image you may need to first map your host folder containing source files into /src/thrift (this one is defined inside the container with the VOLUME instruction). The full command may look like as follows:

docker run -v <host source folder>:/src/thrift evarga/thrift <target language> <.thrift file name>

For example, to compile the Thrift tutorial (assuming you have previously put the source files inside the /thrift/tutorial folder on your host) for Java issue the following:

docker run -v /thrift/tutorial:/src/thrift evarga/thrift java tutorial.thrift

The generated files will be put inside the /thrift/tutorial/gen-java folder on your host.

To build your server and/or client components you may copy the whole 'lib' folder from the container. Thrift is situated inside /usr/local/thrift-<version number> (like, 0.9.1) folder in the container. The rest of the folder structure is the same as the official Thrift's tarball, what you may download from the Thrift's site.

Here is an example to copy the library for Java into a lib folder on a host:

docker cp <container ID>:/usr/local/thrift-0.9.1/lib/java lib/

What version of Thrift is inside the image?

The image is tagged with 'latest' and I will try to keep updating it to always reflect the newest version of Thrift. In order to find out what version of Thrift is contained inside your downloaded image just issue the following command:

docker inspect evarga/thrift

Look for the following line (this is an example for version 0.9.1):


Note for Mac OS X users

On Mac OS X Docker is available via the boot2docker tool. This starts up a separate VM and mapped volumes are not on the host, but inside this VM. Therefore, I recommend a very simple procedure to use the system:

  1. Copy over your .thrift files into the boot2docker VM using scp. Remeber the folder containing these files.
  2. Map the previously mentioned path as host folder when invoking Docker.
  3. Copy over the generated files onto your host using again scp.

The IP address of the boot2docker VM is stored inside the DOCKER_HOST env. variable (this is the one which needs to be exported).

Docker Pull Command
Source Repository