{"id":19293814,"url":"https://github.com/ivanmarban/gcp-pubsub-emulator","last_synced_at":"2026-04-16T19:40:20.682Z","repository":{"id":205643870,"uuid":"714677924","full_name":"ivanmarban/gcp-pubsub-emulator","owner":"ivanmarban","description":"A Docker container image of GCP PubSub emulator","archived":false,"fork":false,"pushed_at":"2023-11-13T20:59:30.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-24T00:25:41.561Z","etag":null,"topics":["docker","docker-image","gcloud-pubsub","gcp","google","google-cloud","google-cloud-platform","pubsub","pubsub-emulator"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivanmarban.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}},"created_at":"2023-11-05T15:26:35.000Z","updated_at":"2025-02-20T17:34:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"d5a052dd-d29c-4bc0-b23e-5ddac2d17a4b","html_url":"https://github.com/ivanmarban/gcp-pubsub-emulator","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"9486c529c57c2fa8a78b62eb31f97e37c77fbc7c"},"previous_names":["ivanmarban/gcp-pubsub-emulator"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ivanmarban/gcp-pubsub-emulator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanmarban%2Fgcp-pubsub-emulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanmarban%2Fgcp-pubsub-emulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanmarban%2Fgcp-pubsub-emulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanmarban%2Fgcp-pubsub-emulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanmarban","download_url":"https://codeload.github.com/ivanmarban/gcp-pubsub-emulator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanmarban%2Fgcp-pubsub-emulator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270892136,"owners_count":24663540,"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-08-17T02:00:09.016Z","response_time":129,"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":["docker","docker-image","gcloud-pubsub","gcp","google","google-cloud","google-cloud-platform","pubsub","pubsub-emulator"],"created_at":"2024-11-09T22:36:11.469Z","updated_at":"2026-04-16T19:40:20.615Z","avatar_url":"https://github.com/ivanmarban.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gcp-pubsub-emulator\n\n[![Release](https://img.shields.io/github/v/release/ivanmarban/gcp-pubsub-emulator?logo=github)](https://github.com/ivanmarban/gcp-pubsub-emulator/releases)\n[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/ivanmarban/gcp-pubsub-emulator/build-test-push.yaml?logo=github\u0026label=build)](https://github.com/ivanmarban/gcp-pubsub-emulator/actions/workflows/build-test-push.yaml)\n[![Image tags](https://ghcr-badge.egpl.dev/ivanmarban/gcp-pubsub-emulator/tags?trim=major\u0026label=image%20tags)](https://github.com/ivanmarban/gcp-pubsub-emulator/pkgs/container/gcp-pubsub-emulator)\n[![Latest image](https://ghcr-badge.egpl.dev/ivanmarban/gcp-pubsub-emulator/latest_tag?trim=major\u0026label=latest)](https://github.com/ivanmarban/gcp-pubsub-emulator/pkgs/container/gcp-pubsub-emulator)\n[![Image size](https://ghcr-badge.egpl.dev/ivanmarban/gcp-pubsub-emulator/size?trim=major\u0026label=image%20size)](https://github.com/ivanmarban/gcp-pubsub-emulator/pkgs/container/gcp-pubsub-emulator)\n\nA Docker container image of GCP PubSub emulator\n\n## Installation\n\nA pre-built Docker container is available from ghcr.io:\n\n```\ndocker run --rm -ti -p 8085:8085 --name pubsub ghcr.io/ivanmarban/gcp-pubsub-emulator:latest\n```\n\nOr, if you prefer to build it yourself:\n\n```\ngit clone https://github.com/ivanmarban/gcp-pubsub-emulator.git\ncd gcp-pubsub-emulator\ndocker build --build-arg GOOGLE_CLOUD_SDK_VERSION=453.0.0 -t gcp-cloud-emulator:latest .\n```\nWhere `GOOGLE_CLOUD_SDK_VERSION` corresponds for version of Google Cloud SDK\n\n## Prerequisites\n\n- Docker runtime\n\n## Usage\n\nAfter running the above `docker run` command, the container will start and configure automatically following resources:\n\n- project id: `myproject`\n- topic: `mytopic`\n- subscription: `mysubscription`\n- emulator listening port: `8085`\n\nPublishing a message:\n\n```\ndocker exec pubsub curl -s -X POST 'http://localhost:8085/v1/projects/myproject/topics/mytopic:publish' \\\n    -H 'Content-Type: application/json' \\\n    --data '{\"messages\":[{\"attributes\":{\"attribute1\":\"value1\",\"attribute2\":\"value2\"},\"data\":\"eyJrZXkiOiAidmFsdWUifQ==\"}]}'\n```\n\n- The [publish](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/publish) API accepts an array of messages\n- The [message](https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage) payload must be base64-encoded\n\n\n\n## Configuration\n\nIf the default configuration does not meet your needs, you can tune it using environment variables.\n\n### Environment variables\n\n| Parameter Name       | Description                                                                | Default value                                                               |\n|----------------------|----------------------------------------------------------------------------|-----------------------------------------------------------------------------|\n| PUBSUB_PORT          | Port number to run the emulator                                            | 8085                                                                        |\n| PUBSUB_PROJECT       | The project id                                                             | myproject                                                                   |\n| PUBSUB_SETUP         | A json representation of topics \u0026 subscriptions to be created              | {\"topics\":[{\"name\":\"mytopic\",\"subscriptions\":[{\"name\":\"mysubscription\"}]}]} |\n| SETUP_RETRIES        | Number of retries of the setup script waiting for the emulator to be ready | 10                                                                          |\n| SETUP_SLEEP_INTERVAL | Specify a duration for which the setup script should sleep between retries | 2                                                                           |\n\n### Topics and subscriptions json schema\n\n```json\n{\n  \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n  \"title\": \"Topics and subscriptions\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"topics\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"name\": {\n            \"type\": \"string\"\n          },\n          \"subscriptions\": {\n            \"type\": \"array\",\n            \"items\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"name\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"required\": [\n                \"name\"\n              ]\n            }\n          }\n        },\n        \"required\": [\n          \"name\",\n          \"subscriptions\"\n        ]\n      }\n    }\n  },\n  \"required\": [\n    \"topics\"\n  ]\n}\n```\n\n## Examples\n\n```\ndocker run --rm -ti -p 8888:8888 \\\n    -e PUBSUB_PORT=8888 \\\n    -e PUBSUB_PROJECT=project1 \\\n    -e 'PUBSUB_SETUP={\"topics\":[{\"name\":\"topic1\",\"subscriptions\":[{\"name\":\"subscription1\"},{\"name\":\"subscription2\"}]}]}' \\\n    -e SETUP_RETRIES=5 \\\n    -e SETUP_SLEEP_INTERVAL=1 \\\n    --name pubsub ghcr.io/ivanmarban/gcp-pubsub-emulator:latest\n```\n\n```yaml\n---\nversion: '3.9'\nservices:\n  pubsub-emulator:\n    container_name: pubsub\n    image: ghcr.io/ivanmarban/gcp-pubsub-emulator:latest\n    ports:\n      - \"8888:8888\"\n    environment:\n      PUBSUB_PORT: 8888\n      PUBSUB_PROJECT: project1\n      PUBSUB_SETUP: '{\"topics\":[{\"name\":\"topic1\",\"subscriptions\":[{\"name\":\"subscription1\"},{\"name\":\"subscription2\"}]}]}'\n      SETUP_RETRIES: 5\n      SETUP_SLEEP_INTERVAL: 1\n    healthcheck:\n      test: curl --fail localhost:8888/v1/projects/project1/subscriptions/subscription2 || exit 1\n      interval: 5s\n      retries: 10\n```\n\n## Special Thanks\nThis project was inspired by [marcelcorso/gcloud-pubsub-emulator](https://github.com/marcelcorso/gcloud-pubsub-emulator)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanmarban%2Fgcp-pubsub-emulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanmarban%2Fgcp-pubsub-emulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanmarban%2Fgcp-pubsub-emulator/lists"}