[Docker] Container communcation

For example you have two containers running

Container A: need to talk to Container B

Container B, running a node application export port 1337

 

From container A

docker compose exec -it containerA bash

You can ping container B

nc -v containerB 1337

To check whether the connection is correct

 

Inside code of container A

  this.tRPC = createTRPCProxyClient<ContainerBRouter>({
    links: [
      httpBatchLink({
        url: 'http://conatienrB:1337',
      }),
    ],
  })

 

posted @ 2023-05-31 20:00  Zhentiw  阅读(6)  评论(0编辑  收藏  举报