Unable to get the dgraph/standalone docker image to work with docker-compose. Most likely issue is user error but I have been unable to find a working example.
Steps to reproduce the issue (command/config used to run Dgraph).
Here is the relevant section of the docker compose file:
dgraph-standalone_1 | E0617 22:58:52.216163 42 groups.go:1177] Error during SubscribeForUpdates for prefix "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15dgraph.graphql.schema\x00": Unable to find any servers for group: 1. closer err: <nil>
I’m guessing this is a result of dgraph zero not being run. However, if I run dgraph zero with the following config, then ratel is no longer available on port 8000.
The standalone container just runs both an alpha and zero process in one container:
dgraph zero & dgraph alpha
So it should have both running. When you change the command in your snippet, you are only running the zero.
Ratel is not running in that container but can be accessed at play.dgraph.io and connecting to your local instance. (Or by running it’s container in your compose setup)
OK, I can confirm that if I build an image thusly:
FROM dgraph/standalone:v21.03.2
EXPOSE 6080
and run that image via my Dgraph Docker Helper in which I programmatically bind a free port to 6080, then I’m able to access the /assign endpoint at the natted port in my golang tests (via http.Get). Still not sure how forcing the bind with docker run -P is working (the Docker Golang SDK is not).
@MichelDiz Not sure if that’s worth a PR given that I’m the first person (I’m guessing) that needed to access 6080 in E2E tests using the Docker Golang SDK. Thoughts?
when you exposed the port with -p that port did not have to be in the docker file. Honestly EXPOSE in the docker file does nothing at all. From the docker docs:
The EXPOSE instruction does not actually publish the port. It functions as a type of documentation between the person who builds the image and the person who runs the container, about which ports are intended to be published.
So when you added the port with -p it worked because that is the only way it actually exposes the port.
Yea I do not know anything about the docker SDK but sounds like a good hypothesis to me. Note I was not arguing against adding the EXPOSE layer to the standalone image in the docker repo, I was merely explaining why it worked when you used docker run with -p.