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.

  • What is the benefit of Docker container for a memcached instance?
  • Docker Security issue around ENTRYPOINT
  • Cannot connect to the Docker daemon. Is the docker daemon running on this host?
  • docker-compose keeps using old image content
  • Cannot connect to postgres server in docker
  • File mounted as docker volume becomes corrupt when saved outside docker
  • 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 (compose) fails to build container when mounting single file from official Wordpress image
  • Why is it not possible to call locale-gen with sudo inside a docker container?
  • Docker-compose Daemon mode logs
  • Run TFS with Docker
  • creating a docker image with the same name
  • Docker Entrypoint script cannot get $DB_PORT_3306_TCP_ADDR environment variable
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.