I'm trying to connect to a Dockerized version of Selenium on the same host within one Python script. This is running on a server, so this is necessarily headless. I'd like to use the Firefox driver. The Docker container seems to be created and runs fine, however I keep getting "the connection reset by peer error". My Python script is as follows: import docker from selenium import webdriver client = docker.from_env() client.images.pull("selenium/standalone-firefox:135.0.1-geckodriver-0.36.0-20250303") firefox = client.containers.run("selenium/standalone-firefox:135.0.1-geckodriver-0.36.0-20250303", detach = True, name = "firefox", ports = {4444: 4444, 7900: 7900}, shm_size = "2G", environment = ["SE_START_XVFB=false", "SE_SCREEN_WIDTH=1200", "SE_SCREEN_HEIGHT=900"]) print(client.containers.list()) # this shows me the container, also I see it in `docker ps` try: driver = webdriver.Remote( command_executor="http://127.0.0.1:4444/wd/hub", options=webdriver.FirefoxOptions() ) driver.get("http://www.python.org") except Exception as e: print("An exception occurred: ", e) This raises the exception: An exception occurred: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) How do I resolve this? Continue reading...