docker / docker/docker-py

PyPI - docker Integration in Flask app

Open
#3,272 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

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'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository file, documentation page, or test to change. Start by reviewing the reported Flask example and ModuleNotFoundError, then locate the project's existing usage documentation; the work is complete only when a specific Flask integration guide and its expected dependency setup are defined and added.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, flask, python
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.