Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Unable to deploy Zalenium with DOCKER_HOST env #762

Closed
topikettunen opened this issue Nov 6, 2018 · 3 comments · Fixed by #788
Closed

Unable to deploy Zalenium with DOCKER_HOST env #762

topikettunen opened this issue Nov 6, 2018 · 3 comments · Fixed by #788

Comments

@topikettunen
Copy link

Please make sure that you provide enough information for us to help you with this issue. Thank you!

Zalenium Image Version(s): 3.14.0g

Docker Version: Docker version 18.06.1-ce

If using docker-compose, version: -

OS: Windows 10, Ubuntu 16.04, Ubuntu 18.04

Docker Command to start Zalenium:

docker run --rm -ti --name zalenium -p 4444:4444 -e DOCKER_HOST=tcp://ip-addr -v videos:/home/seluser/videos --privileged dosel/zalenium start

If using Kubernetes, specify your environment, and if relevant your manifests: -

Expected Behavior -

To work similarly to running the Zalenium with -v /var/run/docker.sock:/var/run/docker.sock

Actual Behavior -

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

@diemol
Copy link
Contributor

diemol commented Nov 18, 2018

Hi @topikettunen,

Sorry for the late reply. It does not work because we never tried it with tcp for DOCKER_HOST. More in detail, it seems that we never connected that env var with the value being used, see this piece of code.

Would you like to give us a hand a connect the dots so it is possible to use it?

@topikettunen
Copy link
Author

topikettunen commented Nov 19, 2018

Upon very quick investigation I saw that you are using Spotify's Docker Client for controlling containers. That client seems to provide .fromEnv() function for creating DefaultDockerClient based on DOCKER_HOST and DOCKER_CERT_PATH env vars. So I think that changing private DockerClient dockerClient = new DefaultDockerClient("unix:///var/run/docker.sock"); to private DockerClient docker = DefaultDockerClient.fromEnv().build(); could do the trick. (Similarly to this.)

Since when you don't provide any DOCKER_HOST environment variable Docker uses the Unix socket by default (which you can then provide by sharing the socket via volume) and in the other hand when the variable is provided it tries to connect to the Docker host via TCP or SSH (from Docker 18.09 on).

I'm not familiar with your code or Spotify's Docker Client (or Java in general) so basically I'm just spitballing ideas.

@diemol
Copy link
Contributor

diemol commented Dec 2, 2018

Hi @topikettunen,

We made some fixes and this -e DOCKER_HOST=tcp://ip-addr is possible now. We will release a new version with this change in the next days.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants