Supervisord running flask app calling docker app

I have a flask app that calls my dockerized app using subprocess.

@app.route('/detect', methods=['POST'])
def detect_file():
    file = request.files['wireframe']
    if file and allowed_file(file.filename):
        filename = str(uuid.uuid4()) + getFileExtension(file.filename)['UPLOAD_FOLDER'],
    p = subprocess.Popen(["docker","run","-v","/home/ganaraj/contours/upload:/detect","-w",
            "/detect","-it","--rm","opecv3", "./prediction",
                   filename ], stdout=subprocess.PIPE)
    output, err = p.communicate()
    return jsonify(result=output.rstrip())
    return jsonify(error='Mismatch file type')

When I run the flask app on its own python it works just fine. I get back a result from the dockerized app.
When I run the flask app using gunicorn directly gunicorn it works fine too.

  • Is there an App-V / Docker equivalent for Mac OSX?
  • VMWare VIC (Photon OS + Docker) vs CoreOS + Docker
  • Docker cp Path not specified
  • rsyslog inside docker containers => “rsyslogd is not running … failed”
  • Launch Docker containers to handle HTTP requests
  • How to check whether a docker service is already running on UCP using shell script
  • When I run the flask app through gunicorn and use supervisor to keep it going – the app launches – api’s work normally EXCEPT THE DOCKERIZED part.
    I am guessing this has something to do with the permissions of some sort but I cant figure out what exactly I need to do to solve this.

    Here is my supervisord.conf for reference.

    command = /root/anaconda/envs/cvuload/bin/gunicorn -b --debug --log-level debug wsgi:app
    directory = /home/ganaraj/contours

    Is there any changes I need to do to any part of this whole tool chain so that I cna get it working fine ?

  • docker container not available at port 80 like it should
  • Pandoc HTML to DOCX images load locally but not on server
  • How to push docker images into a private registry with a full URL?
  • Passing sensitive information to Docker container in AWS EC2 container service
  • Pycharm 2017 docker support for debugging
  • How to make current environment as image docker in ubunu 14.04?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.