[Docker] Container communcation

发布时间 2023-05-31 20:08:04作者: Zhentiw

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',
      }),
    ],
  })