{"id":20532115,"url":"https://github.com/prefecthq/prefect-docker","last_synced_at":"2025-05-09T12:31:34.237Z","repository":{"id":57747746,"uuid":"523469688","full_name":"PrefectHQ/prefect-docker","owner":"PrefectHQ","description":"Prefect integrations for working with Docker","archived":false,"fork":false,"pushed_at":"2024-04-12T02:09:04.000Z","size":2097,"stargazers_count":43,"open_issues_count":20,"forks_count":13,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-04-20T00:47:15.754Z","etag":null,"topics":["docker","prefect","python"],"latest_commit_sha":null,"homepage":"https://prefecthq.github.io/prefect-docker/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PrefectHQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-10T19:19:37.000Z","updated_at":"2024-04-26T16:29:06.740Z","dependencies_parsed_at":"2023-10-30T22:24:42.403Z","dependency_job_id":"3f25ea7c-7a46-4c7a-9474-6bb71cad4989","html_url":"https://github.com/PrefectHQ/prefect-docker","commit_stats":{"total_commits":97,"total_committers":7,"mean_commits":"13.857142857142858","dds":"0.31958762886597936","last_synced_commit":"3fc1993dabdf15cc7c849f36a2bb7f060d61b9ae"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrefectHQ%2Fprefect-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrefectHQ%2Fprefect-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrefectHQ%2Fprefect-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrefectHQ%2Fprefect-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PrefectHQ","download_url":"https://codeload.github.com/PrefectHQ/prefect-docker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224859674,"owners_count":17381682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","prefect","python"],"created_at":"2024-11-16T00:12:58.518Z","updated_at":"2024-11-16T00:12:59.189Z","avatar_url":"https://github.com/PrefectHQ.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!NOTE]\n\u003e Active development of this project has moved within PrefectHQ/prefect. The code can be found [here](https://github.com/PrefectHQ/prefect/tree/main/src/integrations/prefect-docker) and documentation [here](https://docs.prefect.io/latest/integrations/prefect-docker).\n\u003e Please open issues and PRs against PrefectHQ/prefect instead of this repository.\n\n\n# prefect-docker\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://pypi.python.org/pypi/prefect-docker/\" alt=\"PyPI version\"\u003e\n        \u003cimg alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/prefect-docker?color=26272B\u0026labelColor=090422\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/PrefectHQ/prefect-docker/\" alt=\"Stars\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/stars/PrefectHQ/prefect-docker?color=26272B\u0026labelColor=090422\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://pepy.tech/badge/prefect-docker/\" alt=\"Downloads\"\u003e\n        \u003cimg src=\"https://img.shields.io/pypi/dm/prefect-docker?color=26272B\u0026labelColor=090422\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/PrefectHQ/prefect-docker/pulse\" alt=\"Activity\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/commit-activity/m/PrefectHQ/prefect-docker?color=26272B\u0026labelColor=090422\" /\u003e\u003c/a\u003e\n    \u003cbr\u003e\n    \u003ca href=\"https://prefect-community.slack.com\" alt=\"Slack\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/slack-join_community-red.svg?color=26272B\u0026labelColor=090422\u0026logo=slack\" /\u003e\u003c/a\u003e\n\n\u003c/p\u003e\n\n## Welcome!\n\nPrefect integrations for working with Docker.\n\nNote! The `DockerRegistryCredentials` in `prefect-docker` is a unique block, separate from the `DockerRegistry` in `prefect` core. While `DockerRegistry` implements a few functionality from both `DockerHost` and `DockerRegistryCredentials` for convenience, it does not allow much configuration to interact with a Docker host.\n\nDo not use `DockerRegistry` with this collection. Instead, use `DockerHost` and `DockerRegistryCredentials`.\n\n## Getting Started\n\n### Python setup\n\nRequires an installation of Python 3.8+.\n\nWe recommend using a Python virtual environment manager such as pipenv, conda, or virtualenv.\n\nThese tasks are designed to work with Prefect 2. For more information about how to use Prefect, please refer to the [Prefect documentation](https://docs.prefect.io/).\n\n### Installation\n\nInstall `prefect-docker` with `pip`:\n\n```bash\npip install prefect-docker\n```\n\nThen, register to [view the block](https://docs.prefect.io/concepts/blocks/) on Prefect Cloud:\n\n```bash\nprefect block register -m prefect_docker\n```\n\nNote, to use the `load` method on Blocks, you must already have a block document [saved through code](https://docs.prefect.io/concepts/blocks/#saving-blocks) or saved through the UI.\n\n### Pull image, and create, start, log, stop, and remove Docker container\n\n```python\nfrom prefect import flow, get_run_logger\nfrom prefect_docker.images import pull_docker_image\nfrom prefect_docker.containers import (\n    create_docker_container,\n    start_docker_container,\n    get_docker_container_logs,\n    stop_docker_container,\n    remove_docker_container,\n)\n\n\n@flow\ndef docker_flow():\n    logger = get_run_logger()\n    pull_docker_image(\"prefecthq/prefect\", \"latest\")\n    container = create_docker_container(\n        image=\"prefecthq/prefect\", command=\"echo 'hello world!' \u0026\u0026 sleep 60\"\n    )\n    start_docker_container(container_id=container.id)\n    logs = get_docker_container_logs(container_id=container.id)\n    logger.info(logs)\n    stop_docker_container(container_id=container.id)\n    remove_docker_container(container_id=container.id)\n    return container\n```\n\n### Use a custom Docker Host to create a Docker container\n```python\nfrom prefect import flow\nfrom prefect_docker import DockerHost\nfrom prefect_docker.containers import create_docker_container\n\n@flow\ndef create_docker_container_flow():\n    docker_host = DockerHost(\n        base_url=\"tcp://127.0.0.1:1234\",\n        max_pool_size=4\n    )\n    container = create_docker_container(\n        docker_host=docker_host,\n        image=\"prefecthq/prefect\",\n        command=\"echo 'hello world!'\"\n    )\n\ncreate_docker_container_flow()\n```\n\n## Resources\n\nIf you encounter any bugs while using `prefect-docker`, feel free to open an issue in the [prefect-docker](https://github.com/PrefectHQ/prefect-docker) repository.\n\nIf you have any questions or issues while using `prefect-docker`, you can find help in the [Prefect Slack community](https://prefect.io/slack).\n\nFeel free to ⭐️ or watch [`prefect-docker`](https://github.com/PrefectHQ/prefect-docker) for updates too!\n\n## Development\n\nIf you'd like to install a version of `prefect-docker` for development, clone the repository and perform an editable install with `pip`:\n\n```bash\ngit clone https://github.com/PrefectHQ/prefect-docker.git\n\ncd prefect-docker/\n\npip install -e \".[dev]\"\n\n# Install linting pre-commit hooks\npre-commit install\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprefecthq%2Fprefect-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprefecthq%2Fprefect-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprefecthq%2Fprefect-docker/lists"}