aerokube/selenoid

[SERVICE_STARTUP_FAILED] [wait: http://172.17.0.2:4444/wd/hub does not respond in 30s]

jfholanda opened this issue · 2 comments

Anyone can help me? All container are in the same network... I've already used the service-startup-timeout command, and if it helps at all, I'm on Ubuntu 22. PLEASE HELP ME

Always I have this issue when running a python code for connect with selenoid:

selenoid           | 2024/08/09 17:06:23 [-] [NEW_REQUEST] [unknown] [172.24.0.1]
selenoid           | 2024/08/09 17:06:23 [-] [NEW_REQUEST_ACCEPTED] [unknown] [172.24.0.1]
selenoid           | 2024/08/09 17:06:23 [1] [LOCATING_SERVICE] [chrome] [127.0]
selenoid           | 2024/08/09 17:06:23 [1] [USING_DOCKER] [chrome] [127.0]
selenoid           | 2024/08/09 17:06:23 [1] [CREATING_CONTAINER] [selenoid/chrome:127.0]
selenoid           | 2024/08/09 17:06:23 [1] [STARTING_CONTAINER] [selenoid/chrome:127.0] [32ce8eb9f57fbcad31c79427ae376101e8b4d261d985694196b8f5dd62a375b4]
selenoid           | 2024/08/09 17:06:23 [1] [CONTAINER_STARTED] [selenoid/chrome:127.0] [32ce8eb9f57fbcad31c79427ae376101e8b4d261d985694196b8f5dd62a375b4] [0.42s]
selenoid           | 2024/08/09 17:06:53 [1] [REMOVING_CONTAINER] [32ce8eb9f57fbcad31c79427ae376101e8b4d261d985694196b8f5dd62a375b4]
selenoid           | 2024/08/09 17:06:54 [1] [CONTAINER_REMOVED] [32ce8eb9f57fbcad31c79427ae376101e8b4d261d985694196b8f5dd62a375b4]
selenoid           | 2024/08/09 17:06:54 [1] [SERVICE_STARTUP_FAILED] [wait: http://172.17.0.2:4444/wd/hub does not respond in 30s]


python code to connect:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

capabilities = {
    "browserName": "chrome",
    "browserVersion": "127.0",
    "enableVNC": False,
    "enableVideo": False
}

options = Options()
options.set_capability("browserName", capabilities["browserName"])
options.set_capability("browserVersion", capabilities["browserVersion"])
options.set_capability("enableVNC", capabilities["enableVNC"])
options.set_capability("enableVideo", capabilities["enableVideo"])

driver = webdriver.Remote(
    command_executor="http://localhost:4444/wd/hub",
    options=options
)

python error:
WebDriverException: Message: wait: http://172.17.0.2:4444/wd/hub does not respond in 30s

selenoid-test/selenoid/browsers.json:

{
    "chrome": {                                     
      "default": "127.0",                             
      "versions": {                                  
        "127.0": {                                    
          "image": "selenoid/chrome:127.0",          
          "port": "4444",
          "path": "/wd/hub"                       
        }
      }
    }
}

My docker-compose.yml:

version: '3'

networks:
  selenoid:
    external:
      name: selenoid

services:
  selenoid:
    networks:
      - selenoid
    image: aerokube/selenoid:1.10.0
    container_name: selenoid
    ports:
      - "4444:4444"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./selenoid/:/etc/selenoid/:ro

  selenoid-ui:
    networks:
      - selenoid
    image: aerokube/selenoid-ui:latest
    ports:
      - "8080:8080"
    command: --selenoid-uri http://selenoid:4444
    depends_on:
      - selenoid

  selenoid-chrome:
    networks:
      - selenoid
    image: selenoid/chrome:127.0

Docker logs when start:

selenoid-chrome_1  | 2024/08/09 17:03:33 [INIT] [Listening on :7070]
selenoid           | 2024/08/09 17:03:33 [-] [INIT] [Loading configuration files...]
selenoid           | 2024/08/09 17:03:33 [-] [INIT] [Loaded configuration from /etc/selenoid/browsers.json]
selenoid-chrome_1  | Connection failure: Connection refused
selenoid-chrome_1  | pa_context_connect() failed: Connection refused
selenoid-chrome_1  | Waiting X server...
selenoid           | 2024/08/09 17:03:33 [-] [INIT] [Video Dir: /opt/selenoid/video]
selenoid-chrome_1  | Waiting X server...
selenoid           | 2024/08/09 17:03:33 [-] [INIT] [Did not manage to determine your Docker API version - using default version: 1.41]
selenoid           | 2024/08/09 17:03:33 [-] [INIT] [Timezone: UTC]
selenoid           | 2024/08/09 17:03:33 [-] [INIT] [Listening on :4444]
selenoid-chrome_1  | Logging to: /dev/null
selenoid-chrome_1  | Waiting X server...
selenoid-chrome_1  | Starting ChromeDriver 127.0.6533.72 (9755e24ca85aa18ffa16c743f660a3d914902775-refs/branch-heads/6533@{#1760}) on port 4444
selenoid-chrome_1  | All remote connections are allowed. Use an allowlist instead!
selenoid-chrome_1  | Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
selenoid-chrome_1  | ChromeDriver was started successfully.
selenoid-ui_1      | 2024/08/09 17:03:34 [INIT] [Listening on :8080

@jfholanda you are all constantly doing the same error. Docker network where Selenoid is running should be the same as -contaner-network flag value. Otherwise Selenoid will not be able to connect to created containers and this error happens. In docs we give ready to use and working docker compose configuration (https://aerokube.com/selenoid/latest/#_option_2_running_selenoid_in_custom_docker_network). Research about any errors you get on customized configurations you do are your responsibility.

Works. Thank you! I hadn't seen that little detail.