1

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

boomchickawawa
  • 508
  • 1
  • 6
  • 25
  • What's going wrong? Do you specify `docker run --name`s for the containers? Do you have any source code showing how the containers connect or how they use these environment variables? – David Maze Mar 10 '23 at 11:42
  • When I spin the images, they still can't connect to each other. Also, all of the config is taken care of by the image itself, it just needs to know what the ENV vars are @DavidMaze – boomchickawawa Mar 10 '23 at 16:09
  • from what you have shared, the commands looks just fine. just to be sure if containers are able to communicate you can try to ping one container from another. `docker container exec -it my_container1 ping mycontainer2` and `docker container exec -it my_container2 ping mycontainer1`. If these commands run fine, then issue might be woth app configuration and not the containers themselves – sxddhxrthx Mar 13 '23 at 04:32
  • hi @sxddhxrthx I get this error when I run the ping command OCI runtime exec failed: exec failed: unable to start container process: exec: "ping": executable file not found in $PATH: unknown. are you able to run those two images on your local? – boomchickawawa Mar 13 '23 at 05:31
  • this is the error when I spin up the second image "2023-03-13 05:43:44,107 ERROR [cubestore::cluster] Error in processing loop: Internal: Can't connect to cubestore_router:9999: failed to lookup address information: Name or service not known". – boomchickawawa Mar 13 '23 at 05:45

1 Answers1

3

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!

boomchickawawa
  • 508
  • 1
  • 6
  • 25