NativeConnection.connect is not finding temporal server on docker

Hello team,

I am running a docker image locally and getting the following error message:

docker run -p 80:80 -it [aws_id]
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
dummy log here
another 1
TransportError: tonic::transport::Error(Transport, hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 99, kind: AddrNotAvailable, message: "Cannot assign requested address" })))
    at Function.connect (/opt/app-root/src/.yarn/cache/
    at async run (/opt/app-root/src/packages/temporal-workflows/dist/main.js:30:18)

It seems to fail at this LoC where i try to connect to the temporal server:

  connection = await NativeConnection.connect({
    address: 'localhost:7233',

but i have the temporal server running locally at that host:

➜  temporal-workflows git:(jackwang/solve-temporal-worker-bug) ✗ docker container ps
CONTAINER ID   IMAGE                                          COMMAND                  CREATED        STATUS              PORTS                                                                      NAMES
5f557fbcf05a   temporalio/ui:2.1.0                            "./"   4 weeks ago    Up About a minute>8080/tcp                                                     temporal-ui
61dbc0edc365   temporalio/admin-tools:1.17.0                  "tail -f /dev/null"      4 weeks ago    Up About a minute                                                                              temporal-admin-tools
34a21853fa49   temporalio/auto-setup:1.17.0                   "/etc/temporal/entry…"   4 weeks ago    Up About a minute   6933-6935/tcp, 6939/tcp, 7234-7235/tcp, 7239/tcp,>7233/tcp   temporal
➜  temporal-workflows git:(jackwang/solve-temporal-worker-bug) ✗ docker port 34a21853fa49
7233/tcp ->

What am i missing here?


Can you show result of
docker container ls --format "table {{.ID}}\t{{.Image}}\t{{.Names}}"

assuming the name of your container with id 34a21853fa49 is “temporal”
address: 'temporal:7233',

CONTAINER ID   IMAGE                                          NAMES
5f557fbcf05a   temporalio/ui:2.1.0                            temporal-ui
61dbc0edc365   temporalio/admin-tools:1.17.0                  temporal-admin-tools
34a21853fa49   temporalio/auto-setup:1.17.0                   temporal

using temporal instead of localhost gives me the same error
EDIT: nvm i need to rebuild the image. lemme try that

Yea i rebuilt the image and ran it again and im getting the same error

Can you show your service def for your app in your docker compose?
Also I am not TS SDK expert but might be worth trying:

import { Connection, WorkflowClient } from '@temporalio/client';
const connection = await Connection.connect({
    address: 'temporal:7233'

That’s the Client snippet, which isn’t used for the Worker. I believe jwang is running the Worker?

Looks like the port is binding to 7233/tcp -> Can you get it to bind to localhost:7233 or

Sorry, how do i get it to bind on localhost?

What i have rn in my docker-compose is:

    container_name: temporal
      - DB=sqlite
      - SKIP_SCHEMA_SETUP=true
      - DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml
    image: temporalio/auto-setup:${TEMPORAL_VERSION}
      - temporal-network
      - 7233:7233
      - ./docker/dynamicconfig:/etc/temporal/config/dynamicconfig
      - ${PWD}/docker/config_template.yaml:/etc/temporal/config/config_template.yaml

which follows from the example here: GitHub - temporalio/docker-compose: Temporal docker-compose files

When you create your container via docker run I believe in order for containers to communicate by name they should be on same network, so for example try adding

docker run ... --network <network>

using the previously mentioned docker container ls command you should be able to see the network name as well:

docker container ls --format "table {{.ID}}\t{{.Image}}\t{{.Names}}\t{{.Network}}"

see if that helps.

Alternatively just push your image to docker via docker push or docker build if you have a Dockerfile for it and then add your service via docker compose yaml something like:

    container_name: mydockerdemo
      - temporal
    image: <your_docker_image>
      - <port>:<port>

that didn’t work but this did:

temporal-workflows git:(jackwang/solve-temporal-worker-bug) docker run -p 80:80 --network host -it [aws_id]

thanks for pointing me in the right direction!