[GH-ISSUE #65] How to Set APPIUM_HOST to container hostname #52

Closed
opened 2026-03-01 15:39:42 +03:00 by kerem · 5 comments
Owner

Originally created by @rlupo09 on GitHub (Feb 13, 2018).
Original GitHub issue: https://github.com/budtmo/docker-android/issues/65

I'm attempting to set the environment variable APPIUM_HOST to the hostname of the container.

I'm not sure if you're familiar with the docker image selenium/node-chrome, but there you're able to override the host and set it to the hostname of the container by doing entrypoint: bash -c 'SE_OPTS="-host $$HOSTNAME" /opt/bin/entry_point.sh'

Selenium Chrome node .yml example

chrome:
image: selenium/node-chrome:3.7.1
ports:
- "5556:5556"
depends_on:
- hub
environment:
- HUB_PORT_4444_TCP_ADDR=hub
- HUB_PORT_4444_TCP_PORT=4444
entrypoint: bash -c 'SE_OPTS="-host $$HOSTNAME" /opt/bin/entry_point.sh'

Would you happen to know how to set the APPIUM_HOST to the hostname of the container?

SamsungGalaxyS6:
image: butomo1989/docker-android-x86-7.1.1
ports:
- 6080:6080
environment:
- DEVICE=Samsung Galaxy S6
- APPIUM=True
- CONNECT_TO_GRID=True
- SELENIUM_HOST=hub
- SELENIUM_PORT=4450
entrypoint: bash -c {How to set appium_host to container hostname}

Use Case:
I'm running on a docker swarm and my reason to set the APPIUM_HOST to the container hostname is that a container can have multiple interfaces when we start appium it tries to make a guess based on the interfaces available. It then sends this address to the hub to contact it back. In case of multiple interfaces the address can be determined wrongly and the hub is not able to communicate back with the node.

To fix this issue we need to ourself determine the hostname of the container.

Originally created by @rlupo09 on GitHub (Feb 13, 2018). Original GitHub issue: https://github.com/budtmo/docker-android/issues/65 I'm attempting to set the environment variable APPIUM_HOST to the hostname of the container. I'm not sure if you're familiar with the docker image selenium/node-chrome, but there you're able to override the host and set it to the hostname of the container by doing entrypoint: bash -c 'SE_OPTS="-host $$HOSTNAME" /opt/bin/entry_point.sh' Selenium Chrome node .yml example chrome: image: selenium/node-chrome:3.7.1 ports: - "5556:5556" depends_on: - hub environment: - HUB_PORT_4444_TCP_ADDR=hub - HUB_PORT_4444_TCP_PORT=4444 entrypoint: bash -c 'SE_OPTS="-host $$HOSTNAME" /opt/bin/entry_point.sh' Would you happen to know how to set the APPIUM_HOST to the hostname of the container? SamsungGalaxyS6: image: butomo1989/docker-android-x86-7.1.1 ports: - 6080:6080 environment: - DEVICE=Samsung Galaxy S6 - APPIUM=True - CONNECT_TO_GRID=True - SELENIUM_HOST=hub - SELENIUM_PORT=4450 entrypoint: bash -c {How to set appium_host to container hostname} Use Case: I'm running on a docker swarm and my reason to set the APPIUM_HOST to the container hostname is that a container can have multiple interfaces when we start appium it tries to make a guess based on the interfaces available. It then sends this address to the hub to contact it back. In case of multiple interfaces the address can be determined wrongly and the hub is not able to communicate back with the node. To fix this issue we need to ourself determine the hostname of the container.
kerem closed this issue 2026-03-01 15:39:42 +03:00
Author
Owner

@budtmo commented on GitHub (Feb 13, 2018):

Hi @rlupo09 ,

could you try to pass APPIUM_HOST in environment variable to overwrite the default value?

<!-- gh-comment-id:365322915 --> @budtmo commented on GitHub (Feb 13, 2018): Hi @rlupo09 , could you try to pass APPIUM_HOST in environment variable to overwrite the default value?
Author
Owner

@budtmo commented on GitHub (Feb 13, 2018):

I will close this ticket because I feel that it is not a bug. please feel free to reopen it if there is a bug. and please join our group chat https://gitter.im/butomo1989/docker-android for further questions.

<!-- gh-comment-id:365323226 --> @budtmo commented on GitHub (Feb 13, 2018): I will close this ticket because I feel that it is not a bug. please feel free to reopen it if there is a bug. and please join our group chat https://gitter.im/butomo1989/docker-android for further questions.
Author
Owner

@rlupo09 commented on GitHub (Feb 13, 2018):

Hi @butomo1989,

It's not a bug, but a help wanted. Yes I can override the default value with the APPIUM_HOST, but how would one get the hostname of the container to override the default value with.

<!-- gh-comment-id:365334928 --> @rlupo09 commented on GitHub (Feb 13, 2018): Hi @butomo1989, It's not a bug, but a help wanted. Yes I can override the default value with the APPIUM_HOST, but how would one get the hostname of the container to override the default value with.
Author
Owner

@budtmo commented on GitHub (Feb 14, 2018):

Hi @rlupo09 ,

If you can try to run command "hostname -i” inside container or if you find the ip from host machine, you can pass through command “export”, e.g. https://github.com/zalando-incubator/docker-locust/blob/master/local.sh#L161-L164. I hope it helps :)

<!-- gh-comment-id:365545495 --> @budtmo commented on GitHub (Feb 14, 2018): Hi @rlupo09 , If you can try to run command "hostname -i” inside container or if you find the ip from host machine, you can pass through command “export”, e.g. https://github.com/zalando-incubator/docker-locust/blob/master/local.sh#L161-L164. I hope it helps :)
Author
Owner

@rlupo09 commented on GitHub (Feb 15, 2018):

Thank you butomo1989. I was able to do it with hostname -i

command: bash -c 'APPIUM_HOST=$$(hostname -i) /usr/bin/supervisord --configuration supervisord.conf'

<!-- gh-comment-id:365788265 --> @rlupo09 commented on GitHub (Feb 15, 2018): Thank you butomo1989. I was able to do it with hostname -i ``` command: bash -c 'APPIUM_HOST=$$(hostname -i) /usr/bin/supervisord --configuration supervisord.conf' ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/docker-android#52
No description provided.