selenoid
selenoid copied to clipboard
Unable to access internal docker website by service name docker-compose
This is my docker-compose.yml looks like
services: db: network_mode: bridge image: postgres:latest restart: always environment: POSTGRES_PASSWORD: password volumes: - ./postgres:/var/lib/postgresql/data
web: network_mode: bridge depends_on: - db image: tomcat:8.5 restart: always links: - db selenoid: image: "aerokube/selenoid:latest-release" network_mode: bridge volumes: - /var/run/docker.sock:/var/run/docker.sock - /config:/etc/selenoid/:ro - /video:/opt/selenoid/video environment: - OVERRIDE_VIDEO_OUTPUT_DIR=video links - web protractor: network_mode: bridge image: protractor:e2e depends_on: - web environment: QA_HOST: web QA_PORT: 8080 SELENOID_HOST : selenoid SELENOID_PORT : 4444 JAVA_HOME: /usr/local/java volumes: - PROJECT_FOLDER/e2e:/protractor - ${JAVA_HOME}:/usr/local/java links: - selenoid - web
As you can see in above yml my text cases are available in "protractor" container My Config has:
seleniumAddress:"http://"+process.env.SELENOID_HOST+":"+process.env.SELENOID_PORT+"/wd/hub",
baseUrl: "http://"+process.env.QA_HOST+":"+process.env.QA_PORT,
basically my code tries to access http://web:8080 . Which is my tomcat instance. But I'm getting This site can’t be reached
But if try to access http://www.google.com . It works fine, And without selenoid server by using directConnect: true. I can access http://web:8080 without any problem.
So if I simplyfy the issue I can load http://www.google.com which is outside url using selenoid. I can't load http://web:8080 which is my docker container using selenoid. Without using selenoid it works fine.
Is there anything I can do to fix this ?
@godomainz this is how Docker works. In order to access containers by name - you have to use custom networks (created with docker network create my-net
) instead of bridge
network. With your configuration - only Docker links will work.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.