{"id":24916864,"url":"https://github.com/wollomatic/container-hoster","last_synced_at":"2026-03-06T22:07:28.769Z","repository":{"id":164343475,"uuid":"565276581","full_name":"wollomatic/container-hoster","owner":"wollomatic","description":"A simple \"etc/hosts\" file injection tool to resolve names of local Docker containers on the host. Like docker-hoster, but written in go.","archived":false,"fork":false,"pushed_at":"2024-12-28T17:31:03.000Z","size":133,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T02:16:21.211Z","etag":null,"topics":["container","docker","docker-hoster"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wollomatic.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-12T22:00:18.000Z","updated_at":"2025-01-22T19:32:33.000Z","dependencies_parsed_at":"2024-06-21T19:04:20.537Z","dependency_job_id":"a1661775-263b-4a30-9e3a-1207640a4e01","html_url":"https://github.com/wollomatic/container-hoster","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wollomatic%2Fcontainer-hoster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wollomatic%2Fcontainer-hoster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wollomatic%2Fcontainer-hoster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wollomatic%2Fcontainer-hoster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wollomatic","download_url":"https://codeload.github.com/wollomatic/container-hoster/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236767334,"owners_count":19201515,"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":["container","docker","docker-hoster"],"created_at":"2025-02-02T08:18:42.449Z","updated_at":"2025-10-17T03:30:59.229Z","avatar_url":"https://github.com/wollomatic.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# container-hoster\nA simple \"etc/hosts\" file injection tool to resolve names of local Docker containers on the host. It is inspired by [docker-hoster](https://github.com/dvddarias/docker-hoster) by [David Darias](https://github.com/dvddarias).\n\n\n## Installation\n\nThe docker image is available on [Docker Hub](https://hub.docker.com/r/wollomatic/container-hoster/). A sample [docker-compose.yml](https://raw.githubusercontent.com/wollomatic/container-hoster/main/compose.yaml) file is provided in the [repository](https://github.com/wollomatic/container-hoster).\n\n## Configuration\nContainer hoster is configured via environment variables. If no env variable is set, container-hoster will use the default value. The following variables are available:\n\n* ``CH_HOSTSFILE``: The path to the hosts file to be injected. Defaults to ``/hosts``. The real hostsfile should be mounted as a bind mount to this path.\n\n* ``CH_INTERVAL``: The interval in seconds to check if an update for the hostsfile is needed. It is formatted as a Go duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as \"300ms\", \"-1.5h\" or \"2h45m\". Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\". Defaults to ``10s``.\n\n* ``CH_HOSTNAME_FROM_CONTAINERNAME``: If set to true, the container name will be used as the hostname. Defaults to ``true``.\n\n* ``CH_HOSTNAME_FROM_LABEL``: If set to true, the value given in container label ``de.wollomatic.container-hoster.name`` will be used as hostname. Defaults to ``false``.\n\n* ``CH_ONLY_LABELED_CONTAINERS``: If set to true, only containers with the label ``de.wollomatic.container-hoster.enable=true`` will be added to the hosts file, and all other containers are ignored. Defaults to ``false``, so every container is added to the hosts file.\n\n* ``CH_NETWORK_REGEXP``: A regular expression to match the network name of the container. Only containers with a matching network name will be added to the hosts file. Defaults to ``.*``.\n\n* ``CH_LOG_EVENTS``: If set to true, all docker events which lead to rewrite the hosts file will be logged to stdout. Defaults to ``false``\n\n## Container labels\nContainer labels are optional. The following labels are available:\n\n* ``de.wollomatic.container-hoster.name``: The hostname to be used for the container if ``CH_HOSTNAME_FROM_LABEL`` is set to ``true``.\n\n* ``de.wollomatic.container-hoster.enable``: If set to ``true``, the container will be added to the hosts file. Defaults to ``true``.\n\n* ``de.wollomatic.container-hoster.exclude``: If set to ``true``, the container will be excluded from the hosts file.\n\n## Security\n\nIn most cases, the container-hoster container will be run as root. This is necessary to be able to write to the hosts file and connect to the docker socket. Giving access to the docker socket is potentially dangerous because a container that has full access to the docker socket could start and stop containers. Container-hoster will only listen to docker events and will not start or stop containers. It will only update the hosts file if a container is started or stopped.\n\nThe build container image is made from scratch and contains no additional software. The dependencies are scanned with [trivy](https://github.com/aquasecurity/trivy-action).\n\nContainer-hoster does not need to have access to any network.\n\n## Changes\n - 0.1.x: Renaming containers will now update the hosts file.\n\n## License\nThis project is licensed under the [MIT license](LICENSE)\n - see the [LICENSE](LICENSE) file for details\n\n## Acknowledgments\nThanks to [David Darias](https://github.com/dvddarias) for the original idea [docker-hoster](https://github.com/dvddarias/docker-hoster).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwollomatic%2Fcontainer-hoster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwollomatic%2Fcontainer-hoster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwollomatic%2Fcontainer-hoster/lists"}