How to network and communicate between docker containers

Make sure the following network is present in both containers docker-compose file:

...
networks:
  my_net:
    name: my_net

Then you can communicate using this format:

users-go:9090/json/login

`users-go` is the container name and 9090 is the internal docker port (not the one you access via from your local machine:

...
services:
  main:
    container_name: users-go
    ...
Errors being resolved
Post "http://users-go:9090/json/login": dial tcp: lookup users-go on 127.0.0.11:53: no such hostCode language: JavaScript (javascript)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.