Download and run docker image with headless chrome
docker run -d -p 9222:9222 --cap-add=SYS_ADMIN justinribeiro/chrome-headless
That should start up chrome headless on docker-ip:9222
That uses Chrome Remote Dev protocol which is not what selenium implements so we’ll try to use Chromedriver
Unable to find a docker file with a combination of Chrome headless + Latest Chrome driver
from selenium.webdriver.chrome.options import Options
opt = Options()
opt.add_argument("--headless")
opt.add_argument("--disable-gpu")
opt.add_argument("--no-sandbox")
opt.add_argument("--remote-debugging-port=9222")
opt.binary_location = "/usr/bin/google-chrome"
driver = webdriver.Remote(command_executor='http://docker-ip:4444/wd/hub', desired_capabilities=opt.to_capabilities())