0

Context: I am trying to build a pipeline. This pipeline consist in 2 phases, the first one is running a tool called DeCoSTAR (it's an executable, a binary) on a bunch of input parameter files. The next part is running a python app over the output files of DeCoSTAR.

What I want is for this pipeline to be user-friendly and portable, so it should run on whatever OS the host user has.

In order to do so, I am trying to use Docker.

Now for the first phase, I created my own Dockerfile based on a python-alpine image :

FROM    python:2.7-alpine3.7

MAINTAINER  *********

COPY    ./DeCoSTAR  /bin/DeCoSTAR

COPY ./DeCoSTAR.py      ./DeCoSTAR.py

DeCoSTAR.py is a way for me to launch the DeCoSTAR executable on a given parameter file (which will be on the host computer). In order for the user to provide this input I use Tkinter :

#!/usr/bin/python2.7
#coding:utf8

from Tkinter import Tk
from tkFileDialog import askopenfilename
import subprocess
from subprocess import call

def main ():

    print ("Input a parameter file:")
    Tk().withdraw() 
    param_file=askopenfilename()
    f= "/bin/DeCoSTAR parameter.file="+param_file    

    subprocess.call(f, shell=True)                       


if __name__=="__main__":
    main()

Now the thing is :

  1. I can't figure out how to run DeCoSTAR.py automatically When I run my image it runs on python2.7. I've tried RUN DeCoSTAR.py but it doesn't work.

  2. I use the exec command in Docker to try if would work either way. I've launched python DeCoSTAR.py and got this :

    tkinter.TclError: no display name and no $DISPLAY environment variable

What I want is to display the open file window in the host computer so that the user can pick up and provide his own parameter file. I don't want it to display the container file, which is why I think it doesn't work.

Mefitico
  • 816
  • 1
  • 12
  • 41
Tyab
  • 5
  • 1
  • 3
  • I don't understand why but my first line : Hi everybody ! has been deleted , so i apologize – Tyab May 14 '18 at 09:07

1 Answers1

0

First, in order to run a python script in Docker is necessary to do it like this:

RUN python DeCoSTAR.py

Second, for your $DISPLAY error, you need first to specify a display to docker in order to use a GUI application. It usually can be done by adding

-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw 

to docker run.

Probably this question can help you if you have problems configuring docker to use your GUI app.

Martin Alonso
  • 726
  • 2
  • 9
  • 16