Search code examples
dockercontainersvirtual-machinedocker-networkcube.js

Docker images unable to talk to each other


I am trying to make two images depend on each other. One acts as the master and the other one is a worker. Here are the two Dockerfiles

FROM cubejs/cubestore:v0.31.58-arm64v8
ENV CUBESTORE_WORKERS=cubestore_worker_1:9001
ENV CUBESTORE_META_PORT=9999
ENV CUBESTORE_SERVER_NAME=cubestore_router:9999

Dockerfile 2

FROM cubejs/cubestore:v0.31.58-arm64v8
ENV CUBESTORE_SERVER_NAME=cubestore_worker_1:9001
ENV CUBESTORE_WORKER_PORT=9001
ENV CUBESTORE_META_ADDR=cubestore_router:9999
ENV CUBESTORE_WORKERS=cubestore_worker_1:9001

I am building the images with docker build -f path/Dockerfile . Running them with the sha256 that is generated after every build using docker run imageid.

I want cubestore_worker_1 to talk to cubestore_router image. I tried the following but I still don't have it working

docker network create my-network
docker run image1id --network my-network
docker run image2id --network my-network

I am really struggling with this. Any idea how I can achieve this? TIA


Solution

  • I had to basically change the values CUBESTORE_SERVER_NAME to the IPv4 address in the docker inspect container output and re run the docker run --network network name conatainername commands and it works like a charm!