Comments (4)
I would guess that your issue is that you are binding the emulator to --host-port 127.0.0.1:8000
. If you bind to the loopback interface of the container, you won't be able to reach the service from outside the container. I didn't see a way to tell the datastore emulator to bind to all interfaces, but a rather simple solution is to just tell docker which hostname to assign and bind to the hostname:
Note the -h gdatastore
arg, as well as --host-port gdatastore:8000
$docker run -h gdatastore -p 8000:8000 google/cloud-sdk gcloud beta emulators datastore start --project=pi-docker --host-port gdatastore:8000 --no-store-on-disk
Executing: /google-cloud-sdk/platform/gcd/gcd.sh create --project_id=pi-docker /.config/gcloud/emulators/datastore
[datastore] Created new Cloud Datastore project in '/.config/gcloud/emulators/datastore' with project ID 'pi-docker'.
Executing: /google-cloud-sdk/platform/gcd/gcd.sh start --host=gdatastore --port=8000 --store_on_disk=False --consistency=0.9 --allow_remote_shutdown /.config/gcloud/emulators/datastore
[datastore] API endpoint: http://localhost:8000/datastore
[datastore] If you are using a library that supports the DATASTORE_LOCAL_HOST environment variable, run:
[datastore]
[datastore] export DATASTORE_LOCAL_HOST=localhost:8000
[datastore]
[datastore] Invoking dev_appserver with args: [--disable_update_check --jvm_flag=-Doauth.is_admin=true --property=datastore.index_configuration_format=yaml --port=8000 --address=gdatastore --property=datastore.force_is_high_replication=true --property=datastore.default_high_rep_job_policy_unapplied_job_pct=10.0 --property=datastore.no_storage=true --allow_remote_shutdown /.config/gcloud/emulators/datastore].
[datastore] Executing [/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java, -Doauth.is_admin=true, -javaagent:/google-cloud-sdk/platform/gcd/.appengine/lib/agent/appengine-agent.jar, -Xbootclasspath/p:/google-cloud-sdk/platform/gcd/.appengine/lib/override/appengine-dev-jdk-overrides.jar, -classpath, /google-cloud-sdk/platform/gcd/CloudDatastore.jar:/google-cloud-sdk/platform/gcd/.appengine/lib/impl/appengine-api.jar:/google-cloud-sdk/platform/gcd/.appengine/lib/appengine-tools-api.jar:/google-cloud-sdk/platform/gcd/.appengine/lib/impl/appengine-api-stubs.jar, com.google.appengine.tools.development.DevAppServerMain, --property=kickstart.user.dir=/, --disable_update_check, --property=datastore.index_configuration_format=yaml, --port=8000, --address=gdatastore, --property=datastore.force_is_high_replication=true, --property=datastore.default_high_rep_job_policy_unapplied_job_pct=10.0, --property=datastore.no_storage=true, --allow_remote_shutdown, /.config/gcloud/emulators/datastore]
[datastore] Sep 21, 2016 4:20:28 AM java.util.prefs.FileSystemPreferences$1 run
[datastore] INFO: Created user preferences directory.
[datastore] Sep 21, 2016 4:20:28 AM com.google.apphosting.utils.jetty.JettyLogger info
[datastore] INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
[datastore] Sep 21, 2016 4:20:29 AM com.google.apphosting.utils.jetty.JettyLogger info
[datastore] INFO: jetty-6.1.x
[datastore] Sep 21, 2016 4:20:29 AM com.google.apphosting.utils.jetty.JettyLogger info
[datastore] INFO: Started SelectChannelConnector@gdatastore:8000
[datastore] Sep 21, 2016 4:20:29 AM com.google.appengine.tools.development.AbstractModule startup
[datastore] INFO: Module instance default is running at http://gdatastore:8000/
[datastore] Sep 21, 2016 4:20:29 AM com.google.appengine.tools.development.AbstractModule startup
[datastore] INFO: The admin console is running at http://gdatastore:8000/_ah/admin
[datastore] Sep 21, 2016 4:20:29 AM com.google.appengine.tools.development.DevAppServerImpl doStart
[datastore] INFO: Dev App Server is now running
And now, from my host machine:
$ curl localhost:8000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Cloud Datastore service</title>
</head>
<body>
<h1>Cloud Datastore service</h1>
<p><a href="https://developers.google.com/datastore/">Google Cloud Datastore</a> is a fully managed, schemaless database for storing non-relational data.</p>
<p>If you were not expecting to see this page, check out the <a href="https://developers.google.com/datastore/docs/activate#limitations">activation guide</a> for more information.</p>
</body>
</html>
from cloud-sdk-docker.
@ckeeney , thanks, that works!
from cloud-sdk-docker.
I have build my google datastore docker image with code below
and make sure I use docker -h gdatastore to start this docker image, then our test can access google datastore emulator inside docker container.
FROM google/cloud-sdk
MAINTAINER ivan.li
# Expose the default port
EXPOSE 8000
CMD ["gcloud","beta", "emulators", "datastore", "start","--project=pi-docker","--host-port", "gdatastore:8000","--consistency","1.0","--no-store-on-disk"]
from cloud-sdk-docker.
@email2liyang This is what I had in mind when I initially set out to use this. https://github.com/ckeeney/docker-datastore-integration
from cloud-sdk-docker.
Related Issues (20)
- Buildx missing HOT 6
- `gke-gcloud-auth-plugin` does not honor `CLOUDSDK_CONFIG` env var HOT 1
- Image tag 433 breaks docker authentication HOT 5
- Entrypoint doesn't work in Dockerfile from version 430.0.0 HOT 2
- Update Alpine image to 3.18 HOT 1
- Pubsub shutdown time
- The Debian packages using the wrong architecture, etc in the official container HOT 1
- Alpine image missing libresolv.so.2 for kubectl HOT 1
- Upgrade Debian image to bookworm HOT 8
- Curl upgrade to include fail-with-body option HOT 3
- Installing config-connector component HOT 2
- kubectl binary contains CVE-2023-39323 security vulnerability HOT 3
- When updating cloud run jobs image, job task-timeout is reset to default value. HOT 1
- Are you planning to host the image on pkg.dev? HOT 2
- google or gcr.io/google.com HOT 2
- APT repository changed Origin to cloud-sdk-bullseye HOT 2
- gcloud-sdk-bookworm InRelease' changed its 'Label' value from 'cloud-sdk-bullseye' to 'cloud-sdk-bookworm' HOT 7
- latest gcloud-sdk:emulators (468) broken (time-out) for create topic pubsub API
- introduce python3 3.11 with the image and make it default
- Attempting to re-establish stream for both 470 and 471
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloud-sdk-docker.