How to put my client into a container?

I’ve successfully implemented my Zeebe Client (using golang) and now I want to put it into a container and ultimately into my k8s cluster. Can someone point me to any Dockerfile examples with Zeebe clients?

Thank you,
Kimberly.

1 Like

Let me ask the question like this. I have the go client bootstrap script (the one from the Zeebe Go Client tutorial that reports on partition leaders/followers). I have docker-compose up running in the operate directory. I can run the go script and see the partition leader/follower output.

Now I have put the same bootstrap go script into a docker container. It can’t communicate with the broker. If I specify/expose the 26500 port, then rightly so, error because the port is already in use. If I don’t specify the port, then it’s a gprc communication error.

Am I approaching this problem incorrectly? I appreciate your guidance.

You only expose server ports, so your client container should not expose any ports.

Docker container networking depends on the environment you are running in.

You cannot connect to ‘localhost’ on the host from a containerized client, because the container’s local interface is distinct from the host’s local interface. You have to use the FQDN of the host to get to mapped ports in other containers, or put the containers on the same docker network and use “link” and the container name (which resolves via Docker’s DNS).

The usual way to do this is to configure the connection via env vars, and use docker-compose.

But here is what you need to flatten:

What is the host OS?
Is your client container and Zeebe gateway container running on the same host?

Your problem at the moment seems to be “how do I connect to a Dockerised Zeebe broker from a client running in a container on the same machine”.

One straight answer to that question:

  1. Map the broker container port 26500 to the host.
  2. Allow port 26500 on the host’s firewall.
  3. Point the client to the resolvable name / address of the host.

Works on the same host and across hosts.

Alternative - only on same host (will work on your dev machine / a single host in prod):

  1. Start both client and broker containers on the same network (maybe in a docker-compose file, or by manually creating and then specifying the docker network)
  2. Use the container name.


For how you do it in K8s - it depends on whether your client runs in the same K8s cluster as the broker, and how you configure the ingress if it is outside the K8s cluster.

1 Like