DNS lookup failure with Firefox under docker-compose

222 views
Skip to first unread message

Aidan Gauland

unread,
May 29, 2021, 7:46:59 AM5/29/21
to Selenium Users
I have the standalone Firefox Selenium docker-container set up in my application's docker-compose file for end-to-end testing, and I have had to pass Selenium the IP address of my app's container instead of just using the container name, because using the container name was making Firefox return the error page "about:neterror?e=dnsNotFound".  It's as if Firefox is using its own DNS resolver that doesn't work properly inside a docker network.

My docker-compose.yml:
version: "3.3"
services:
  phoenix:
    build:
      context: .
      dockerfile: Dockerfile.dev
    ports:
      - 4000:4000
      - 4001:4001
      - 4002:4002
    depends_on:
      - db
      - selenium
    environment:
      - POSTGRES_HOST=db
    volumes:
      - .:/paddy

  db:
    image: postgres:11
    environment:
      - POSTGRES_HOST_AUTH_METHOD=trust
    ports:
      - "${DB_PORT}:5432"
    volumes:
      - "${HOME}/srv/paddy-db:/var/lib/postgresql/data"

  selenium:
    image: selenium/standalone-firefox:4
    ports:
      - 4444:4444
      - 7900:7900
    volumes:
      - /dev/shm:/dev/shm

And the error I get from my test framework (Hound) is
Reached error page: about:neterror?e=dnsNotFound&u=http%3A//phoenix%3A4002/&c=UTF-8&d=We%20can%E2%80%99t%20connect%20to%20the%20server%20at%20phoenix

Has anyone managed to get such a setup working?

Regards,
Aidan Gauland

Reply all
Reply to author
Forward
0 new messages