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)
        file.save(os.path.join(app.config['UPLOAD_FOLDER'],
                    filename))
    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 app.py it works just fine. I get back a result from the dockerized app.
When I run the flask app using gunicorn directly gunicorn wsgi.py it works fine too.

  • How to run at the same time two or more docker-compose files
  • Postgres networking with Docker containers and host LAN
  • Docker Compose Dev and Production Environments Best Workflow
  • ./configure: error: the HTTP gzip module requires the zlib library
  • jenkins/docker with environment variables
  • Execute bash command if docker container does not exist
  • 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.

    [program:cvupload]
    command = /root/anaconda/envs/cvuload/bin/gunicorn -b 0.0.0.0:9000 --debug --log-level debug wsgi:app
    directory = /home/ganaraj/contours
    user=root
    

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

  • nginx php-fpm crashes (maybe docker)
  • Best way to copy files from Docker volume on remote server to local host?
  • Docker image for project with separate client and server side codebase
  • CoreOS cluster installation alternatives (offline)
  • Using Docker Containers
  • openldap + kerberos - unable to reach any KDC in realm
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.