Docker: using container with headless Selenium Chromedriver
I think the issue here might not Docker, but the code. The Selenium images provide a interface to a Selenium Server through remote Webdriver, and the code provided tries to directly instantiate a Chrome browser using chromedriver, a thing that is possible with Selenium Python bindings, provided that chromedriver is accessible from the environment.
Maybe it would work better using the example from the docs :
from selenium.webdriver.common.desired_capabilities import DesiredCapabilitiesdriver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub',desired_capabilities=DesiredCapabilities.CHROME)