Docker Community Forums

Share and learn in the Docker community.

Identify inter container request in docker-compose

Know if request is from a container in the same network created by docker compose

If I want to make request to a container within same network I can do that by a http request like

http://service-name:port/

But how can I know if this http request is coming from a container in the same network created by docker-compose ?
docker-compose.yml

    version: '3'
services:
  users:
    build: './users'
    ports:
      - '4001:3000'
    volumes:
      - './users:/src/'
  products:
    build: './products'
    ports:
      - '4002:3000'
    volumes:
      - './products:/src/'
  orders:
    build: './orders'
    ports:
      - '4003:3000'
    volumes:
      - './orders:/src/'
  payments:
    build: './payments'
    ports: 
      - '4004:3000'
    volumes: 
      - './payments:/src/'