{"id":19311582,"url":"https://github.com/rednafi/docker-local-subdomain","last_synced_at":"2025-09-17T09:31:16.692Z","repository":{"id":37963745,"uuid":"492418848","full_name":"rednafi/docker-local-subdomain","owner":"rednafi","description":"Locally access Docker services as 'subdomain.localhost' instead of 'localhost:port'","archived":false,"fork":false,"pushed_at":"2025-06-23T14:51:56.000Z","size":833,"stargazers_count":6,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-23T15:28:22.707Z","etag":null,"topics":["dns","docker","express","nodejs"],"latest_commit_sha":null,"homepage":"","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/rednafi.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}},"created_at":"2022-05-15T07:36:19.000Z","updated_at":"2025-06-23T14:17:43.000Z","dependencies_parsed_at":"2023-02-19T07:15:54.471Z","dependency_job_id":"e1e5bfb3-aef8-429e-916f-4047bc35495f","html_url":"https://github.com/rednafi/docker-local-subdomain","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rednafi/docker-local-subdomain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rednafi%2Fdocker-local-subdomain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rednafi%2Fdocker-local-subdomain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rednafi%2Fdocker-local-subdomain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rednafi%2Fdocker-local-subdomain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rednafi","download_url":"https://codeload.github.com/rednafi/docker-local-subdomain/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rednafi%2Fdocker-local-subdomain/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275568573,"owners_count":25488497,"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-09-17T02:00:09.119Z","response_time":84,"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":["dns","docker","express","nodejs"],"created_at":"2024-11-10T00:29:27.256Z","updated_at":"2025-09-17T09:31:16.438Z","avatar_url":"https://github.com/rednafi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1\u003eDocker Local Subdomain\u003c/h1\u003e\n\n\u003cimg src=\"art/logo.svg\" alt=\"logo\"\u003e\n\n\u003c/div\u003e\n\nEver had a hard time remembering the port numbers of different services in your local\n[Docker](https://docs.docker.com/) stack? This example demonstrates how you can access\nthe services via `\u003csubdomain\u003e.localhost` instead of `localhost:\u003cport\u003e`.\n\n*This is a simple node stack running two [Express](https://expressjs.com/) servers in two\ndifferent containers. You can access the services via `foo.localhost` and `bar.localhost`\nrespectively. Here, [Caddy](https://caddyserver.com/) is used as a reverse proxy to\ndirect the requests to the appropriate containers.*\n\n## Prerequisites\n\nThis example assumes that you're running a Unix system with Docker \u003e= 20.10.15, Docker\ncompose v2, [cURL](https://curl.se/), and [jq](https://stedolan.github.io/jq/) installed.\n\n## Installation\n\nClone the repo, go to the root directory, and run:\n\n```\nmake up\n```\n\nThis will spin up three containers—a single reverse proxy and two application containers.\n\n## Usage\n\nYou can make requests to the containers as follows:\n\n```bash\ncurl -s -X GET http://foo.localhost | jq\n```\n\nThis returns:\n\n```json\n{\n  \"status\": \"ok\",\n  \"statusCode\": 200,\n  \"containerIP\": \"219.20.128.1\",\n  \"message\": \"Hello world from container 1\"\n}\n```\n\nSimilarly, you can access the second service as follows:\n\n```bash\ncurl -s -X GET http://bar.localhost | jq\n```\n\nThis returns:\n\n```json\n{\n  \"status\": \"ok\",\n  \"statusCode\": 200,\n  \"containerIP\": \"219.20.128.2\",\n  \"message\": \"Hello world from container 2\"\n}\n```\n\nHere, the containers have static IPs and you can see that the two requests are handled\nby two different containers.\n\n## Todo\n\n* Add caching to the CI.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frednafi%2Fdocker-local-subdomain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frednafi%2Fdocker-local-subdomain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frednafi%2Fdocker-local-subdomain/lists"}