# Cannot Make Ray Server Ports Visible in Docker

**URL:** <https://discuss.ray.io/t/cannot-make-ray-server-ports-visible-in-docker/13447>\
**Category:** Ray Serve\
**Created:** [January 17, 2024, 10:38pm UTC](https://discuss.ray.io/t/cannot-make-ray-server-ports-visible-in-docker/13447 "2024-01-17T22:38:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wpm](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/wpm/32/4241_2.png) [@wpm](https://discuss.ray.io/u/wpm)\
**Post date:** [January 17, 2024, 10:38pm UTC](https://discuss.ray.io/t/cannot-make-ray-server-ports-visible-in-docker/13447/1 "2024-01-17T22:38:06Z")

</div>

I want to host a Ray server application in a Docker image. Following the example in [Customer Docker Images](https://docs.ray.io/en/latest/serve/production-guide/docker.html), I created a Python script called `fake.py`.

```python
from faker import Faker

from ray import serve

@serve.deployment
def create_fake_email():
    return Faker().email()

app = create_fake_email.bind()

```

In the same directory I have a Dockerfile.

```ini
FROM rayproject/ray:latest

RUN pip install Faker==18.13.0

WORKDIR /serve_app

COPY fake.py /serve_app/fake.py

EXPOSE 8000 8265

ENTRYPOINT ["serve", "run", "fake:app"]

```

I build the image.

```bash
 docker build . -t ray-server

```

Then I run the image.

```bash
docker run -p 8000:8000 -p 8265:8265 ray-server

```

The ray server starts. From inside the container I can connect to the dashboard on port 8265 and run the server application on port 8000, but neither of these work from the host machine.

```auto
curl http://localhost:8000
curl: (7) Failed to connect to localhost port 8000 after 0 ms: Couldn't connect to server
curl http://localhost:8265
curl: (7) Failed to connect to localhost port 8265 after 0 ms: Couldn't connect to server

```

I’m sure I’m doing all the Docker commands correctly. This appears to be the same as a problem reported for Ray 2.5.0 in the [About Dashboard inside Docker](https://discuss.ray.io/t/about-dashboard-inside-docker/4065/14) post on this board.

Is this a bug? Does anyone have a workaround?

**How severely does this issue affect your experience of using Ray?**

- High: It blocks me from completing my task.

---

<div class="post-metadata">

**Author:** ![wpm](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/wpm/32/4241_2.png) [@wpm](https://discuss.ray.io/u/wpm)\
**Post date:** [January 20, 2024, 5:31pm UTC](https://discuss.ray.io/t/cannot-make-ray-server-ports-visible-in-docker/13447/2 "2024-01-20T17:31:23Z")

</div>

> [@wpm](#):
>
> `["serve", "run", "fake:app"]`

I can run the server if I add `--host 0.0.0.0` to the run command and access the server from the host machine at `http://0.0.0.0:8000/`.

```auto
CMD ["serve", "run", "server:app", "--host", "0.0.0.0"]

```

I still can’t see the Ray dashboard. This seems to be the same issue discussed in [Ray Dashboard cannot be accessed in the host browser](https://discuss.ray.io/t/ray-dashboard-cannot-be-accessed-in-the-host-browser/6326).
