Accessing another docker container within different docker container using protractor

my docker-compose.yml file

version: "3"

services:
  mydb:
    image: localhost:5000/mydb
    restart: always
    environment:
      POSTGRES_PASSWORD: mypassword
      TZ: "Australia/Perth"
    volumes:
      - ./postgres:/var/lib/postgresql/data


  myweb:
    depends_on:
      - mydb
    image: localhost:5000/myweb
    restart: always
    ports:
      - "80:8080"
    environment:
      TZ: "Australia/Perth"
    volumes:
      - ./web/logs/:/misc/docker/webapps/ROOT/WEB-INF/apps/logs/

  protractor:
    image: localhost:5000/protractor
    depends_on:
      - myweb
    environment: 
      QA_HOST: myweb
    volumes: 
      - /home/akila/Projects/Project/e2e:/protractor

above is my docker-compose file.

I have 3 containers mydb,myweb,protractor.

I’m trying to access myweb from protractor

I access my baseUrl like this –> baseUrl: "http://"+process.env.QA_HOST+":80/",

I’m using docker-compose up command.

It seems my protractor container cannot load myweb.

I printed url and page source with console logs.

This is what I can see on my console logs.

--------------------------url is-------------http://myweb:80/editor/index.jsp
<html><head></head><body></body></html>

As you can see html returns nothing.

But url seems correct. Because it shows http://myweb:80/editor/index.jsp

But I can clearly access the website from my browser using http://localhost:80/editor/index.jsp

I’m using google chrome headless mode in my protractor tests.
How can I load port 80 in myweb container from my protractor container ?

Source: StackOverflow