{"id":16195305,"url":"https://github.com/tethik/docker-hosts-update","last_synced_at":"2026-01-31T23:07:42.761Z","repository":{"id":50207178,"uuid":"125749718","full_name":"Tethik/docker-hosts-update","owner":"Tethik","description":"Service that automatically updates your /etc/hosts file based on your running docker containers.","archived":false,"fork":false,"pushed_at":"2023-07-26T09:36:42.000Z","size":75,"stargazers_count":2,"open_issues_count":5,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T20:52:02.851Z","etag":null,"topics":["docker","linux","microservices"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tethik.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":"2018-03-18T17:24:22.000Z","updated_at":"2023-02-21T22:40:08.000Z","dependencies_parsed_at":"2024-10-27T20:17:12.314Z","dependency_job_id":"51536df9-1044-47e0-a15a-814f71966a23","html_url":"https://github.com/Tethik/docker-hosts-update","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tethik%2Fdocker-hosts-update","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tethik%2Fdocker-hosts-update/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tethik%2Fdocker-hosts-update/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tethik%2Fdocker-hosts-update/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tethik","download_url":"https://codeload.github.com/Tethik/docker-hosts-update/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247713800,"owners_count":20983774,"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","linux","microservices"],"created_at":"2024-10-10T08:27:00.859Z","updated_at":"2026-01-31T23:07:37.723Z","avatar_url":"https://github.com/Tethik.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Readme\n\n`docker_hosts_update` is a small program that automatically updates your `/etc/hosts` file,\ngiving your docker containers hostnames.\n\nBy default the containers will be given a hostname of `{container name}.{network name}`.\nE.g. The `hello-world` container running in the `corp.internal` network and the `nginx` container\nrunning in the default `bridge` network will be written to your hosts file something like the following. \n```\n172.19.0.3   hello-world.corp.internal\n172.17.0.4   nginx.bridge\n```\n\n## Compatibility\n⚠️ Currently this program is only known to work on Linux. \n\nIt will not work on Windows because Windows uses a different location for the hosts file.\n\nMac OS does not seem to work due to some differences in how the hosts file is written. I'm unsure what these differences are,\nbut Mac OS will not correctly apply the changes.\n\nIf you are a Mac/Windows user and you want to use this program, let us know that you are interested.\nOf course, we would also appreciate it if you could to contribute the necessary changes.\n\n\n## Install\n```bash\nsudo pip3 install -U \"git+https://github.com/Tethik/docker-hosts-update#egg=docker-hosts-update\"\n```\n\n\n## Usage\n```bash\nUsage: docker_hosts_update [OPTIONS]\n\n  Program that automatically updates your `/etc/hosts` file based on your\n  running docker containers.\n\nOptions:\n  --hosts-file TEXT    The hosts file to update.\n  --once               Run the update script once only.\n  --initial            Run the update script one time before hooking into the\n                       docker event stream.\n  -v, --verbosity LVL  Either CRITICAL, ERROR, WARNING, INFO or DEBUG\n  --help               Show this message and exit.\n```\n\nRunning it in a shell:\n```\nsudo docker_hosts_update\n```\n\nSystemd init script to run it as a service:\n```\n[Unit]\nDescription=Updates /etc/hosts based on running docker containers.\nAfter=network.target\n\n[Service]\nExecStart=/usr/local/bin/docker-hosts-update\nRestart=on-failure # or always, on-abort, etc\n\n[Install]\nWantedBy=multi-user.target\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftethik%2Fdocker-hosts-update","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftethik%2Fdocker-hosts-update","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftethik%2Fdocker-hosts-update/lists"}