subprocess not working in docker container subprocess not working in docker container docker docker

subprocess not working in docker container


A few possible reasons:

  1. Does this happen only when multiple users call your web API, invoking libreoffice? If so, you need to make sure that every concurrent libreoffice process has its own independent user installation directory. You can set a custom one using libreoffice -env:UserInstallation=file:///tmp/test.

  2. If your model is that you start a libreoffice process ahead of time, so later libreoffice processes just forward the request to the already started up worker, what version of LibreOffice do you use? For example, the 6.1 line had a bug where we did not wait for conversion result, see https://gerrit.libreoffice.org/#/c/66168/ for the fix. (The about dialog has a version string and an exact git hash. So 6.1.5 has this fix already, but not 6.1.4.)


Check if the version of Python you have developed your code in, and the version with which you are building your container is the same.I faced an exactly similar issue. I was using subprocess.call() to execute something on command line in my code. My code ran perfectly well on my local machine but it failed at subprocess.call() when trying to run inside the docker container. It would although, strangely, run inside the docker if I explicitly wrote subprocess.call() in the interactive Python shell. I even tried experimenting with os.system(). Same issue.

Finally resolved as soon as I made the python versions same (initially they were 3.7.3 for development version and 3.5 for docker container).I hope the same works for you!

Also if someone else could add more technical insight to this dirty fix I suggested, it'll be great.