Submit a job with a Docker image

In this lesson, we are going to submit a job to run inside of a Docker image. Using a Docker image is a nice way to allow the job to have a customized execution environment, regardless of whatever software is installed on the execute node itself. There are many, many Docker images available on the public Docker Hub, and it is easy to build your own.

For example, lets imagine you have a job that needs Python 3. First lets check the version of Python on your machine:

username@learn $ python --version
Python 2.7.5

Indeed, Python 2.7.5 is all you get with Centos 7 out of the box. Now, lets submit a job that will run inside a Docker image named frolvlad/alpine-python3, which is a small image that just contains Python3. Your submit file should look like:

# Tell HTCondor to run inside a docker image 
universe = docker
docker_image = frolvlad/alpine-python3
# And now tell HTCondor what to run, what files to transfer, etc, as usual.
should_transfer_files = YES
executable = /usr/bin/python
arguments = --version
output = docker_python_version.out
queue

After you run it, what does docker_python_version.out say?

 PreviousNext