{"id":32368888,"url":"https://github.com/ldsh-dev/dockepy","last_synced_at":"2026-05-18T10:07:34.664Z","repository":{"id":316451586,"uuid":"1063435268","full_name":"LdSH-dev/dockepy","owner":"LdSH-dev","description":"🐳 DockePy - A Python library for Docker container management and GitHub Actions CI/CD integration","archived":false,"fork":false,"pushed_at":"2025-09-24T17:28:05.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-24T18:20:18.184Z","etag":null,"topics":["ci-cd","docker","docker-container","dockerfile","lib","library","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/dockepy/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LdSH-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-24T16:11:20.000Z","updated_at":"2025-09-24T17:29:21.000Z","dependencies_parsed_at":"2025-09-24T18:20:22.928Z","dependency_job_id":"0675cc20-0a32-4b9c-9a55-141926aa4efe","html_url":"https://github.com/LdSH-dev/dockepy","commit_stats":null,"previous_names":["ldsh-dev/dockepy"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/LdSH-dev/dockepy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LdSH-dev%2Fdockepy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LdSH-dev%2Fdockepy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LdSH-dev%2Fdockepy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LdSH-dev%2Fdockepy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LdSH-dev","download_url":"https://codeload.github.com/LdSH-dev/dockepy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LdSH-dev%2Fdockepy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280856747,"owners_count":26403188,"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","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ci-cd","docker","docker-container","dockerfile","lib","library","python"],"created_at":"2025-10-24T19:35:15.535Z","updated_at":"2025-10-24T19:35:19.595Z","avatar_url":"https://github.com/LdSH-dev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker CI/CD Manager Documentation\n\n## Overview\n\nDocker CI/CD Manager is a Python library that provides a simple and powerful interface for managing Docker containers, building images, and integrating with GitHub Actions for automated CI/CD pipelines.\n\n## Features\n\n- **Container Management**: Create, run, stop, and manage Docker containers\n- **Image Operations**: Pull, build, and manage Docker images\n- **Test Automation**: Create test containers for automated testing\n- **CI/CD Integration**: GitHub Actions workflows for automated testing and deployment\n- **Error Handling**: Comprehensive error handling and logging\n- **Cleanup Utilities**: Automatic cleanup of test containers\n\n## Installation\n\n### Prerequisites\n\n- Python 3.8 or higher\n- Docker installed and running\n- pip package manager\n\n### Install from source\n\n```bash\ngit clone \u003crepository-url\u003e\ncd docker-cicd-manager\npip install -r requirements.txt\npip install -e .\n```\n\n## Quick Start\n\n### Basic Usage\n\n```python\nfrom docker_cicd_manager import DockerManager\n\n# Initialize Docker Manager\ndocker_manager = DockerManager()\n\n# Create a test container\ncontainer = docker_manager.create_test_container(\n    image=\"ubuntu:latest\",\n    command=\"echo 'Hello from Docker!'\",\n    name=\"my-test-container\"\n)\n\n# Get container logs\nlogs = docker_manager.get_container_logs(container.id)\nprint(logs)\n\n# Stop the container\ndocker_manager.stop_container(container.id)\n\n# Cleanup\ndocker_manager.close()\n```\n\n### Advanced Usage\n\n```python\nfrom docker_cicd_manager import DockerManager\n\ndocker_manager = DockerManager()\n\n# Create multiple test containers\ncontainers = []\nfor i in range(3):\n    container = docker_manager.create_test_container(\n        image=\"python:3.11-slim\",\n        command=f\"python -c 'print(\\\"Container {i+1} is working!\\\")'\",\n        name=f\"test-container-{i+1}\"\n    )\n    containers.append(container)\n\n# Wait for completion and check logs\nimport time\ntime.sleep(3)\n\nfor container in containers:\n    logs = docker_manager.get_container_logs(container.id)\n    print(f\"Container {container.id}: {logs}\")\n\n# Cleanup all test containers\ncleaned_count = docker_manager.cleanup_test_containers()\nprint(f\"Cleaned up {cleaned_count} containers\")\n\ndocker_manager.close()\n```\n\n## API Reference\n\n### DockerManager Class\n\n#### Constructor\n\n```python\nDockerManager(base_url=None)\n```\n\n- `base_url` (str, optional): Docker daemon URL. If None, uses default socket.\n\n#### Methods\n\n##### create_test_container(image, command, name=None, **kwargs)\n\nCreate a test container with the specified image.\n\n**Parameters:**\n- `image` (str): Docker image to use\n- `command` (str): Command to run in the container\n- `name` (str, optional): Container name\n- `**kwargs`: Additional container configuration options\n\n**Returns:** Container object\n\n**Raises:**\n- `ImageError`: If image not found\n- `ContainerError`: If container creation fails\n\n##### get_container_logs(container_id)\n\nGet logs from a container.\n\n**Parameters:**\n- `container_id` (str): Container ID or name\n\n**Returns:** Container logs as string\n\n**Raises:**\n- `ContainerError`: If container not found\n\n##### stop_container(container_id)\n\nStop a running container.\n\n**Parameters:**\n- `container_id` (str): Container ID or name\n\n**Returns:** True if successful\n\n**Raises:**\n- `ContainerError`: If container not found\n\n##### list_containers(all_containers=False)\n\nList Docker containers.\n\n**Parameters:**\n- `all_containers` (bool): If True, include stopped containers\n\n**Returns:** List of container objects\n\n##### pull_image(image, tag=\"latest\")\n\nPull a Docker image.\n\n**Parameters:**\n- `image` (str): Image name\n- `tag` (str): Image tag\n\n**Returns:** Image object\n\n**Raises:**\n- `ImageError`: If image pull fails\n\n##### build_image(path, tag, dockerfile=\"Dockerfile\")\n\nBuild a Docker image from a Dockerfile.\n\n**Parameters:**\n- `path` (str): Path to build context\n- `tag` (str): Image tag\n- `dockerfile` (str): Dockerfile name\n\n**Returns:** Image object\n\n**Raises:**\n- `ImageError`: If image build fails\n\n##### cleanup_test_containers()\n\nClean up all test containers.\n\n**Returns:** Number of containers cleaned up\n\n##### get_docker_info()\n\nGet Docker daemon information.\n\n**Returns:** Dictionary with Docker daemon info\n\n##### close()\n\nClose the Docker client connection.\n\n## Testing\n\n### Running Tests\n\n```bash\n# Run all tests\npython -m pytest tests/ -v\n\n# Run specific test\npython -m pytest tests/test_docker_manager.py::TestDockerManager::test_create_simple_test_container -v\n\n# Run with coverage\npython -m pytest tests/ -v --cov=docker_cicd_manager --cov-report=html\n\n# Use the test runner script\npython run_tests.py\n```\n\n### Test Categories\n\n- **Unit Tests**: Test individual methods and functions\n- **Integration Tests**: Test Docker integration\n- **Error Handling Tests**: Test error scenarios\n\n## CI/CD Integration\n\n### GitHub Actions\n\nThe library includes GitHub Actions workflows for:\n\n- **Continuous Integration**: Automated testing on push/PR\n- **Code Quality**: Linting, formatting, type checking\n- **Security Scanning**: Bandit and Safety checks\n- **Docker Testing**: Integration tests with Docker\n- **Release Management**: Automated releases\n\n### Workflow Files\n\n- `.github/workflows/ci.yml`: Main CI pipeline\n- `.github/workflows/release.yml`: Release automation\n\n## Examples\n\n### Basic Examples\n\nSee `examples/basic_usage.py` for simple usage examples.\n\n### Advanced Examples\n\nSee `examples/advanced_usage.py` for complex scenarios.\n\n## Error Handling\n\nThe library provides comprehensive error handling:\n\n- `DockerManagerError`: Base exception\n- `ContainerError`: Container-related errors\n- `ImageError`: Image-related errors\n\n### Code Style\n\n- Follow PEP 8\n- Use Black for formatting\n- Use Flake8 for linting\n- Use MyPy for type checking\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests for new functionality\n5. Run the test suite\n6. Submit a pull request\n\n## License\n\nMIT License\n\n## Support\n\nFor issues and questions:\n- Create an issue on GitHub\n- Check the documentation\n- Review the examples","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fldsh-dev%2Fdockepy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fldsh-dev%2Fdockepy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fldsh-dev%2Fdockepy/lists"}