CockroachDB secure inside DockerContainer dont start with my domain/ip

Hello Dear Cockroach Forum,

I’m quite unexperienced with Cockroach until a few days ago I didn’t even know it existed. I have already set up an insecure and a secure cockroach database system. now I would like to build my own docker image using cockroach secure. But now the error occurs again and again:

* ERROR: cockroach server exited with error: consider changing the port via --http-addr: listen tcp bind: cannot assign requested address
Failed running "start"

To start cockroach within my docker container I proceed in the Dockerfile as follows:

RUN ./cockroach cert create-ca --certs-dir=$COCKROACH_CERT_DIR --ca-key=$COCKROACH_KEYS_DIR/ca.key
RUN ./cockroach cert create-client root --certs-dir=$COCKROACH_CERT_DIR --ca-key=$COCKROACH_KEYS_DIR/ca.key
RUN ./cockroach cert create-node $COCKROACH_HOSTNAME $(hostname) --certs-dir=$COCKROACH_CERT_DIR --ca-key=$COCKROACH_KEYS_DIR/ca.key

EXPOSE 26257 8080

In the script that I call in ENTRYPOINT, I then execute the actual start.

./ start --certs-dir=$COCKROACH_CERT_DIR --listen-addr=$COCKROACH_HOSTNAME

I hope you can help me with this question. :slight_smile:

Hi @valentinwinkelmann,

You might find our instructions on creating an insecure cluster using docker valuable as a starting point. Did you start by initiating a bridge network?



If you’d like to bind to a specific interface with an ip address that address needs to be available inside the container. This depends on how you’ve started the container.

For example: if your docker host has the ip and you launch the container with docker run --net=host that ip is available inside the container.

I don’t think this issue is related to cockroach specifically.