Docker does read my path

Traceback (most recent call last):
  File "/app/newLumea107.py", line 86, in <module>
    driver = webdriver.Remote(
             ^^^^^^^^^^^^^^^^^


my Script.py
options.add_argument(r'--user-data-dir=C:\Users\user\AppData\Local\Google\Chrome\User Data')
options.add_argument(r'--profile-directory=Profile 4')

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

and my docker-compose.yml

services:
  selenium:
    image: selenium/standalone-chrome
    container_name: selenium_chrome
    shm_size: 2g
    ports:
      - "4444:4444"
      - "5900:5900"
    volumes:
      - "/c/Users/user/AppData/Local/Google/Chrome/User Data/Profile 4:/home/seluser/.config/google-chrome/Profile 4"
    command: /opt/bin/entry_point.sh
    environment:
      - SE_NODE_OVERRIDE_MAX_SESSIONS=true
      - VNC_NO_PASSWORD=1
      - SCREEN_WIDTH=1280
      - SCREEN_HEIGHT=720

  bot:
    build: .
    container_name: selenium_bot
    depends_on:
      - selenium
    environment:
      - SELENIUM_REMOTE_URL=http://selenium:4444/wd/hub
    volumes:
      - "/c/Users/user/AppData/Local/Google/Chrome/User Data/Profile 4:/home/seluser/.config/google-chrome/Profile 4"

I think the issue is about my selenium_bot even though I likely doing correct and still :((

Path to user GoogleChrome is correct …

This doesn’t make sense. Why should the container be able to use the host paths? This would a fundamental violation of the container isolation. You need to use the container path /home/seluser/.config/google-chrome instead.

My Script changed to

options = Options()
options.add_argument("--disable-gpu")
options.add_argument("--no-sandbox")
options.add_argument("--user-data-dir=/home/seluser/.config/google-chrome")
options.add_argument("--profile-directory=Profile 4")

try:
    driver = webdriver.Remote(
        command_executor=os.getenv("SELENIUM_REMOTE_URL", "http://selenium:4444/wd/hub"),
        options=options
    )
    driver.get("https://www.google.com")
    print(driver.title)
except Exception as e:
    print("Error:", e)
finally:
    if 'driver' in locals():
        driver.quit() />

My docker-compose.yml

services:
  selenium:
    image: selenium/standalone-chrome
    container_name: selenium_chrome
    shm_size: 2g
    ports:
      - "4444:4444"
      - "5900:5900"
    volumes:
      - "C:\\Users\\user\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 4:/home/seluser/.config/google-chrome/Profile 4"
    command: /opt/bin/entry_point.sh
    environment:
      - SE_NODE_OVERRIDE_MAX_SESSIONS=true
      - VNC_NO_PASSWORD=1
      - SCREEN_WIDTH=1280
      - SCREEN_HEIGHT=720

  bot:
    build: .
    container_name: selenium_bot
    depends_on:
      - selenium
    environment:
      - SELENIUM_REMOTE_URL=htp://selenium:4444/wd/hub
    volumes:
      - "C:\\Users\\user\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 4:/home/seluser/.config/google-chrome/Profile 4"

networks:
  selenium_network:
    driver: bridge

Always getting the error Error:

Message: Could not start a new session. Error while creating session with the driver service. 
Stopping driver service: Could not start a new session. Response code 500. Message: session not created

AND

Error response from daemon: container dbfc585ca9fdb317db0211fabc2cc180294894816f4c2470bef2d9d6ed0ba172 is not running

selenium_network or selenium_bot may not be connected to selenium_chrome.

I tried to change as much as I could :frowning:


Please, format your post according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

Example code block:

```
echo "I am a code."
echo "An athletic one, and I wanna run."
```

After fixing your post, please send a new comment so people are notified about the fixed content.


You forgot to

And you also created a new topic with the same post: Docker Selenium Bot Fails to Start: Profile Directory Not Found & Network Connection Issues
which I deleted first as duplicate, but restored as it seems you have a different issue there.

Please, make sure that you refer to a previous topic when you move your post to a new one and comment in the original topic so people know why you seem to start the same discussion in two topics and you also let people who helped you know that they solved your original problem.

I close this topic just to avoid people replying here to the same question.