Appium docker doesn't connect to Selenium docker running locally

Hello,

I need help connecting an Appium docker container to a Selenium docker container, both running locally on my machine. This is the error I receive:

[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[Appium] An attempt to register with the grid was unsuccessful: Request failed with status code 404
[debug] [Appium] Hub down or not responding: Request failed with status code 404

I am unable to find much documentation on this setup and the posts I did find don’t seem to help. I have tried toml files, custom Appium configs, every possible combination of IP addresses and ports and it just doesn’t connect.

To reproduce what I think should work, follow these steps:

Step 1. In Docker, running on a development machine, run this command to start Selenium…

docker run -p 4444:4444 -v $PWD/config.toml:/opt/bin/config.toml --name selenium-hub selenium/hub

This does indeed start Selenium and I can view the Portal UI at: http://localhost:4444/ui

The toml config file contains:

[server]
port = 4444

[node]
detect-drivers = false

[relay]
# Default Appium server endpoint
url = "http://localhost:4723/wd/hub"
status-endpoint = "/status"
# Stereotypes supported by the service
configs = [
  "1", "{\"browserName\": \"chrome\", \"platformName\": \"android\", \"appium:platformVersion\": \"11\"}"
]

Step 2. In the same Docker instance, running on your development machine, but in a new cmd shell, run this command to start Appium…

docker run --privileged -p 4723:4723 -e CONNECT_TO_GRID=true -e APPIUM_HOST=“127.0.0.1” -e APPIUM_PORT=4723 -e SELENIUM_HOST=“172.17.0.2” -e SELENIUM_PORT=4444 -v /dev/bus/usb:/dev/bus/usb --name container-appium appium/appium

I have verified that the SELENIUM_HOST variable is what Selenium expects via this output statement in Selenium: INFO [Hub.execute] - Started Selenium Hub 4.3.0 (revision a4995e2c09*): http://172.17.0.2:4444

Although both containers start and run successfully, as stated above, no matter what I try, I always receive the “Hub down or not responding” error. I suspect the toml file is not being used even though I’ve verified it exists inside the docker container in the /opt/bin/ directory or the relay section is being ignored.

Any help in resolving this would be greatly appreciated.

Thanks,
Pete

Update: I got it working using the “selenium/standalone-docker” image.

I am using selenium grid 4 in local docker and docker-android for local android emulator which contains appium. I am getting same error “Hub down or not responding” error.
I tried using selenium/standalone-docker instead of selenium/node-docker but that doesn’t help.

docker run --privileged -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -e DEVICE=“Samsung Galaxy S10” -e APPIUM=true -e CONNECT_TO_GRID=true -e APPIUM_HOST=“127.0.0.1” -e APPIUM_PORT=4723 -e SELENIUM_HOST=“172.29.32.1” -e SELENIUM_PORT=4444 -e MOBILE_WEB_TEST=true --name android-container budtmo/docker-android-x86-11.0

Please let me know if anyone knows how to fix this error.