# Ray serve worker node container can't find remote ray cluster head node

**URL:** <https://discuss.ray.io/t/ray-serve-worker-node-container-cant-find-remote-ray-cluster-head-node/8164>\
**Category:** Uncategorized\
**Created:** [November 7, 2022, 2:14pm UTC](https://discuss.ray.io/t/ray-serve-worker-node-container-cant-find-remote-ray-cluster-head-node/8164 "2022-11-07T14:14:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moore-Liu](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/moore-liu/32/3398_2.png) [@Moore-Liu](https://discuss.ray.io/u/Moore-Liu)\
**Post date:** [November 7, 2022, 2:14pm UTC](https://discuss.ray.io/t/ray-serve-worker-node-container-cant-find-remote-ray-cluster-head-node/8164/1 "2022-11-07T14:14:34Z")

</div>

Head node docker compose file:

```auto
version: '3'

services:
  ray-head:
    image: ${RAY_CORE_IMAGE}
    build:
      context: .
      dockerfile: ./head/Dockerfile
    ports:
      - "${DASHBOARD_PORT}:${DASHBOARD_PORT}"
      - "${HEAD_NODE_PORT}:${HEAD_NODE_PORT}"
      - "6379:6379"
      - "52365:52365"
      - "22345:22345"
      - "22346:22346"
    env_file:
      - .env
    command: "ray start --head --dashboard-port=${DASHBOARD_PORT} --port=${REDIS_PORT} \
      --dashboard-host ${DASHBOARD_HOST} --object-manager-port=${OBJECT_MANAGER_PORT} \
      --node-manager-port=${NODE_MANAGER_PORT} --include-dashboard true --block"
    shm_size: 2g
    deploy:
      resources:
        limits:
          cpus: '4'
          memory: '2g'
    volumes:
      - /dev/shm:/dev/shm
    network_mode: "host"

```

ray serve worker node docker compose file:

```auto
ray-serve:
    image: ${RAY_SERVE_GATEWAY_IMAGE}
    build:
      context: ../../
      dockerfile: ./deploy/local/worker/Dockerfile
    ports:
      - "${RAY_SERVE_PORT}:${RAY_SERVE_PORT}"
    environment:
      - RAY_ADDRESS="ray://ray-head:10001"
# - RAY_AGENT_ADDRESS="http://172.20.2.1:52365"
    env_file:
      - .env
    command: "serve run -h ${RAY_SERVE_HOST} -p ${RAY_SERVE_PORT} \
    --working-dir ./ ${DEPLOYMENT_NAME}"
    shm_size: 2g
    restart: always
    network_mode: "host"
    depends_on:
      - ray-head

```

docker-compose up, worker node container bash `ray status` will raise error cannot find ray cluster

---

<div class="post-metadata">

**Author:** ![jm-nab](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/jm-nab/32/6289_2.png) [@jm-nab](https://discuss.ray.io/u/jm-nab)\
**Post date:** [July 17, 2024, 9:21pm UTC](https://discuss.ray.io/t/ray-serve-worker-node-container-cant-find-remote-ray-cluster-head-node/8164/2 "2024-07-17T21:21:45Z")

</div>

Here’s what worked for me:

```auto
  ray-head:
    build:
      context: .
      dockerfile: ./dockerfile.ray.cluster
    ports:
      - 6479:6479 # default (6379) but that is also the default for redis port for starting jobs on head node
      - 8265:8265 # default ray dashboard port
      - 10001:10001 # ray client server port
    volumes:
      - ray-data:/var/lib/ray/data
    environment:
      - ENV=local-docker
    command: sh -c 'ray start --head --dashboard-host=0.0.0.0 --dashboard-port=8265 --port=6479 --ray-client-server-port=10001 --block'
    networks:
      - net
    extra_hosts:
    - "host.docker.internal:host-gateway"

  ray-worker-1:
    build:
      context: .
      dockerfile: ./dockerfile.ray.cluster
    depends_on:
      - ray-head
    command: ray start --address=ray-head:6479 --ray-client-server-port=10001 --block
    environment:
      - RAY_HEAD_IP=ray-head
      - ENV=local-docker
    networks:
      - net
    extra_hosts:
    - "host.docker.internal:host-gateway"

```
