Skip to content

Conversation

@MrMohebi
Copy link

Brief Change List

  • Switched from docker.APIClient to docker.DockerClient for modern API compatibility.
  • Fixed hosts file section removal to preserve post-section content.
  • Added support for custom domains via container labels (hoster.domains).
  • Improved event handling with safe decoding and container fetching.
  • Standardized hosts entry formatting (tabs, sorted domains).
  • Added file not found handling and better trimming of lines.
  • Updated Docker package to support new Docker versions (tested up to Docker 29).
  • Updated Python to version 3.14.
  • Created a GitHub Action that builds and stores Docker images on tagging in GitHub Packages.

Brief Explanation of Changes and Why

The core updates modernize the Docker API usage and fix bugs like improper hosts file truncation (which lost user-added content) to make the script more reliable and robust—essential for production use. Label support adds flexibility for custom domains, previously unused. Event and file handling improvements prevent crashes and ensure consistency. Formatting changes align with standard /etc/hosts practices for better readability. Docker package update ensures compatibility with recent Docker releases, avoiding deprecation issues. Python 3.14 upgrade leverages new features like improved error messages and performance. The GitHub Action automates image building/storing on tags, streamlining CI/CD for easier deployments and versioning. All changes keep the script concise while enhancing maintainability.

ederuiter and others added 19 commits March 9, 2020 16:48
Only attempt lines trim if the list isn't empty
Includes .idea and .venv directories to be ignored by Git.
Exclude generated hosts file from version control.
Refactored the Docker event handling to use json parsing for more robust event processing. Updated the hosts file update logic to correctly handle existing sections and ensure atomic writes. Improved container info extraction and error handling.
Includes necessary libraries such as certifi, charset-normalizer, docker, idna, requests, and urllib3.
Add new copyright holder to LICENSE file.
Replaced 'frolvlad/alpine-python3' with 'python:3.14-alpine'.
Modified installation to use requirements.txt for dependencies.
Updated COPY commands for hoster.py and requirements.txt.
Introduces a Dockerfile for building images, a .dockerignore file to exclude unnecessary files, and a GitHub Actions workflow for automatically building and pushing Docker images to GHCR upon release.
Converts the GitHub repository name to lowercase when constructing the `IMAGE_NAME` for pushing to GitHub Container Registry. This ensures consistency and avoids potential issues with case-sensitive image names.
Ensures the repository name used in the Docker image tag is always lowercase for consistency.
The default docker socket path in hoster.py has been updated from "tmp/docker.sock" to "/tmp/docker.sock" to match the Dockerfile's VOLUME mounting. The Dockerfile has also been updated to use ENTRYPOINT and CMD for better container execution, and the README.md has been updated with the new image name.
Changed dockerClient initialization to None to defer client creation until needed. This may prevent issues with early initialization in certain environments.
Retrieve container ID from 'Actor.ID' and add validation
Improved project description, quick start, and container registration details.
@Chi-teck
Copy link

Chi-teck commented Dec 1, 2025

This project appears to be unmaintained. It would be great if someone created a fork and continued its development.

@MrMohebi
Copy link
Author

MrMohebi commented Dec 1, 2025

This project appears to be unmaintained. It would be great if someone created a fork and continued its development.

I’ve created a fork, and it’s fully functional with multiple bug fixes:
https://github.com/MrMohebi/docker-hoster

@wollomatic
Copy link

wollomatic commented Dec 1, 2025

https://github.com/wollomatic/container-hoster

There's also my rewrite in Go

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

Successfully merging this pull request may close these issues.

7 participants