Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyPI - docker Integration in Flask app #3272

Open
irtaza9 opened this issue Jun 30, 2024 · 1 comment
Open

PyPI - docker Integration in Flask app #3272

irtaza9 opened this issue Jun 30, 2024 · 1 comment

Comments

@irtaza9
Copy link

irtaza9 commented Jun 30, 2024

I am playing with docker sdk for python in the flask app. But I am facing some errors while using it. I think doc's should add the usage area for flask framework.

from flask import Flask
import docker

app = Flask(__name__)

@app.route("/")
def getAllAvailableImages():
    client = docker.APIClient()
    client = client.from_env()
    api = client.api
    for image in api.images.list():
        print(image.id)

(.venv) ➜ kasm-streaming flask --app app run
Usage: flask run [OPTIONS]
Try 'flask run --help' for help.

Error: While importing 'app', an ImportError was raised:

Traceback (most recent call last):
  File "/Users/irtaza/Desktop/Developer/Ideas/ondemand/kasm-streaming/.venv/lib/python3.12/site-packages/flask/cli.py", line 245, in locate_app
    __import__(module_name)
  File "/Users/irtaza/Desktop/Developer/Ideas/ondemand/kasm-streaming/app.py", line 2, in <module>
    import docker
ModuleNotFoundError: No module named 'docker'
@Khushiyant
Copy link
Contributor

I can't seem to get what's problem here, other than docker not installed/found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants