I am running two centos docker container using following compose file-
version: "2"
services:
  nginx:
    build:
      context: ./docker-build
      dockerfile: Dockerfile.nginx
    restart: always
    ports:
      - "8080:8080"
    command: "/usr/sbin/nginx"
    volumes:
      - ~/my-dir:/my-dir
  data:
    build:
      context: ./docker-build
      dockerfile: Dockerfile.data
    restart: always
    ports:
      - "8081:8081"
    command: "/usr/sbin/nginx"
    volumes:
     - ~/my-dir-1:/my-dir-1
I’m trying to redirect request http://host-IP:8080/my-data/ to the data container using nginx. Below is my Nginx configuration for nginx container
/etc/nginx/conf.d/default.conf
server {
    listen 8080;
  location / {
       root   /my-dir/;
       index  index.html index.htm;
       }
}
I am able to access my-dir directory using http://host-IP:8080 URL and my-dir-1 using http://host-IP:8081 URL, how can I configure Nginx to redirect request on data container using http://host-IP:8080/my-data URL