tree: 870265db8dd74ba3ada4cec5b74ab09a177eadda [path history] [tgz]
  1. Jenkinsfile_docker_cache
  2. Jenkinsfile_utils.groovy
  7. docker/
  9. docker_cache_requirements
  10. other/
  12. travis/
  14. windows/

Containerized build & test utilities

This folder contains scripts and dockerfiles used to build and test MXNet using Docker containers

You need docker and nvidia docker if you have a GPU.

If you are in ubuntu an easy way to install Docker CE is executing the following script:

set -e
set -x
export DEBIAN_FRONTEND=noninteractive
apt-get -y install curl
curl -fsSL | sudo apt-key add -
add-apt-repository \
   "deb [arch=amd64] \
      $(lsb_release -cs) \
apt-get update
apt-get -y install docker-ce
service docker restart
usermod -a -G docker $SUDO_USER

For detailed instructions go to the docker installation instructions.

The main utility to build is which will run docker and mount the mxnet folder as a volume to do in-place builds.

The script does two functions, build the docker image, and it can be also used to run commands inside this image with the propper mounts and paraphernalia required to build mxnet inside docker from the sources on the parent folder.

A set of helper shell functions are in docker/ without arguments or --help will display usage information about the tool.

To build for armv7 for example:

./ -p armv7

To work inside a container with a shell you can do:

./ -p ubuntu_cpu -i

When building, the artifacts are located in the build/ directory in the project root. In case -a is invoked, the artifacts are located in build./

Docker container cleanup (Zombie containers)

Docker has a client-server architecture, so when the program that is executing the docker client dies or receieves a signal, the container keeps running as it‘s started by the docker daemon. We implement signal handlers that catch sigterm and sigint and cleanup containers before exit. In Jenkins there’s not enough time between sigterm and sigkill so we guarantee that containers are not left running by propagating environment variables used by the Jenkins process tree killer to identify which process to kill when the job is stopped. This has the effect of stopping the container given that the process inside the container is terminated.

How to test this is working propperly: On the console you can hit ^C while a container is running (not just building) and see that the container is stopped by running docker ps on another terminal. In Jenkins this has been tested by stopping the job which has containers running and verifying that the container stops shortly afterwards by running docker ps.

Add a platform

To add a platform, you should add the appropriate dockerfile in docker/ and add a shell function named build_ to the file docker/ with build instructions for that platform.


Due to current limitations of the CMake build system creating artifacts in the source 3rdparty folder of the parent mxnet sources concurrent builds of different platforms is NOT SUPPORTED.


For all builds a directory from the host system is mapped where ccache will store cached compiled object files (defaults to /tmp/ci_ccache). This will speed up rebuilds significantly. You can set this directory explicitly by setting CCACHE_DIR environment variable. All ccache instances are currently set to be 10 Gigabytes max in size.