selenoid icon indicating copy to clipboard operation
selenoid copied to clipboard

Selenoid continuously restarting in docker

Open andrei-kotau opened this issue 4 years ago • 13 comments

I am using Debian and trying to run Selenoid at my work. I don't have direct access to that particular virtual machine but some commands I am able to execute (see examples below). I tried to reproduce this issue on my home pc, installed vmware workstation, installed Debian 9 there and everything worked smoothly, I was able to run Selenoid without any issues. But at work, with VMs that are used as Jenkins slaves, Selenoid always restarting. Please let me know what can be wrong, where to search the issue? Does it look like Debian OS misconfiguration or docker installed incorrectly or something else, I am attaching all necessary information below. Let me know if you need additional information and thanks for any help in advance, guys!

cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 9 (stretch)" NAME="Debian GNU/Linux" VERSION_ID="9" VERSION="9 (stretch)" ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"

./cm selenoid stop Using Docker Your Docker API version is 1.40 Stopping Selenoid... Successfully stopped Selenoid

./cm selenoid start Using Docker Your Docker API version is 1.40 Selenoid is already downloaded Selenoid is already configured Starting Selenoid... Successfully started Selenoid

pay attention to line "Restarting (1) 1 second ago..." docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1e16d7fbb2c5 aerokube/selenoid:1.10.0 "/usr/bin/selenoid -???" 6 seconds ago Restarting (1) 1 second ago selenoid bec026b7f19a docker-compose_jenkins-slave "/usr/local/bin/setu???" 2 months ago Up 5 weeks 0.0.0.0:22002->22/tcp docker-compose_jenkins-slave_1

docker logs selenoid 2020/08/26 14:26:52 [-] [INIT] [Loading configuration files...] 2020/08/26 14:26:52 [-] [INIT] [/usr/bin/selenoid: browsers config: read error: open /etc/selenoid/browsers.json: no such file or directory] 2020/08/26 14:26:55 [-] [INIT] [Loading configuration files...] 2020/08/26 14:26:55 [-] [INIT] [/usr/bin/selenoid: browsers config: read error: open /etc/selenoid/browsers.json: no such file or directory] 2020/08/26 14:26:57 [-] [INIT] [Loading configuration files...] 2020/08/26 14:26:57 [-] [INIT] [/usr/bin/selenoid: browsers config: read error: open /etc/selenoid/browsers.json: no such file or directory] 2020/08/26 14:27:00 [-] [INIT] [Loading configuration files...] 2020/08/26 14:27:00 [-] [INIT] [/usr/bin/selenoid: browsers config: read error: open /etc/selenoid/browsers.json: no such file or directory]

docker inspect selenoid [ { "Id": "1e16d7fbb2c5f026c7996704f77e3c20ef7e60e04203068fd38c7dcdd63bb415", "Created": "2020-08-26T14:26:50.54487932Z", "Path": "/usr/bin/selenoid", "Args": [ "-listen", ":4444", "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video/", "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video/", "-video-recorder-image", "selenoid/video-recorder:latest-release", "-log-output-dir", "/opt/selenoid/logs/", "-container-network", "selenoid" ], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 90723, "ExitCode": 0, "Error": "", "StartedAt": "2020-08-26T14:27:03.392846454Z", "FinishedAt": "2020-08-26T14:27:00.646973256Z" }, "Image": "sha256:c349d7b3e7e421496b2f2867c1d4306d79f221ebfdd75539e7b93fa02d4272fd", "ResolvConfPath": "/var/lib/docker/containers/1e16d7fbb2c5f026c7996704f77e3c20ef7e60e04203068fd38c7dcdd63bb415/resolv.conf", "HostnamePath": "/var/lib/docker/containers/1e16d7fbb2c5f026c7996704f77e3c20ef7e60e04203068fd38c7dcdd63bb415/hostname", "HostsPath": "/var/lib/docker/containers/1e16d7fbb2c5f026c7996704f77e3c20ef7e60e04203068fd38c7dcdd63bb415/hosts", "LogPath": "/var/lib/docker/containers/1e16d7fbb2c5f026c7996704f77e3c20ef7e60e04203068fd38c7dcdd63bb415/1e16d7fbb2c5f026c7996704f77e3c20ef7e60e04203068fd38c7dcdd63bb415-json.log", "Name": "/selenoid", "RestartCount": 4, "Driver": "overlay2", "Platform": "linux", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "docker-default", "ExecIDs": null, "HostConfig": { "Binds": [ "/home/jenkins/.aerokube/selenoid:/etc/selenoid:ro,Z", "/home/jenkins/.aerokube/selenoid/video:/opt/selenoid/video:Z", "/home/jenkins/.aerokube/selenoid/logs:/opt/selenoid/logs:Z", "/var/run/docker.sock:/var/run/docker.sock:Z" ], "ContainerIDFile": "", "LogConfig": { "Type": "json-file", "Config": {} }, "NetworkMode": "selenoid", "PortBindings": { "4444/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "4444" } ] }, "RestartPolicy": { "Name": "always", "MaximumRetryCount": 0 }, "AutoRemove": false, "VolumeDriver": "", "VolumesFrom": null, "CapAdd": null, "CapDrop": null, "Capabilities": null, "Dns": null, "DnsOptions": null, "DnsSearch": null, "ExtraHosts": null, "GroupAdd": null, "IpcMode": "private", "Cgroup": "", "Links": null, "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "UsernsMode": "", "ShmSize": 67108864, "Runtime": "runc", "ConsoleSize": [ 0, 0 ], "Isolation": "", "CpuShares": 0, "Memory": 0, "NanoCpus": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": null, "BlkioDeviceReadBps": null, "BlkioDeviceWriteBps": null, "BlkioDeviceReadIOps": null, "BlkioDeviceWriteIOps": null, "CpuPeriod": 0, "CpuQuota": 0, "CpuRealtimePeriod": 0, "CpuRealtimeRuntime": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": null, "DeviceCgroupRules": null, "DeviceRequests": null, "KernelMemory": 0, "KernelMemoryTCP": 0, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": null, "OomKillDisable": false, "PidsLimit": null, "Ulimits": null, "CpuCount": 0, "CpuPercent": 0, "IOMaximumIOps": 0, "IOMaximumBandwidth": 0, "MaskedPaths": [ "/proc/asound", "/proc/acpi", "/proc/kcore", "/proc/keys", "/proc/latency_stats", "/proc/timer_list", "/proc/timer_stats", "/proc/sched_debug", "/proc/scsi", "/sys/firmware" ], "ReadonlyPaths": [ "/proc/bus", "/proc/fs", "/proc/irq", "/proc/sys", "/proc/sysrq-trigger" ] }, "GraphDriver": { "Data": { "LowerDir": "/var/lib/docker/overlay2/c150c60c2a9aedf30af107ea99655886f5fd087caf1d74a29f63bf7c790eab70-init/diff:/var/lib/docker/overlay2/0ef4800522d0e5dfaf54d0843fd2f2d18f95cbe87b24273cb8c960e6d38806f0/diff:/var/lib/docker/overlay2/9ca3e2ab19976dba41db8a43b8b869ce402938b4b54de584322bbb867f139c53/diff:/var/lib/docker/overlay2/a509c1795e249bd06788fb98d59bd9584213e2caf89be7b85e98e24aacae551d/diff", "MergedDir": "/var/lib/docker/overlay2/c150c60c2a9aedf30af107ea99655886f5fd087caf1d74a29f63bf7c790eab70/merged", "UpperDir": "/var/lib/docker/overlay2/c150c60c2a9aedf30af107ea99655886f5fd087caf1d74a29f63bf7c790eab70/diff", "WorkDir": "/var/lib/docker/overlay2/c150c60c2a9aedf30af107ea99655886f5fd087caf1d74a29f63bf7c790eab70/work" }, "Name": "overlay2" }, "Mounts": [ { "Type": "bind", "Source": "/home/jenkins/.aerokube/selenoid", "Destination": "/etc/selenoid", "Mode": "ro,Z", "RW": false, "Propagation": "rprivate" }, { "Type": "bind", "Source": "/home/jenkins/.aerokube/selenoid/video", "Destination": "/opt/selenoid/video", "Mode": "Z", "RW": true, "Propagation": "rprivate" }, { "Type": "bind", "Source": "/home/jenkins/.aerokube/selenoid/logs", "Destination": "/opt/selenoid/logs", "Mode": "Z", "RW": true, "Propagation": "rprivate" }, { "Type": "bind", "Source": "/var/run/docker.sock", "Destination": "/var/run/docker.sock", "Mode": "Z", "RW": true, "Propagation": "rprivate" } ], "Config": { "Hostname": "localhost", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "4444/tcp": {} }, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "OVERRIDE_VIDEO_OUTPUT_DIR=/home/jenkins/.aerokube/selenoid/video", "DOCKER_API_VERSION=1.40", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "Cmd": [ "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video/", "-video-recorder-image", "selenoid/video-recorder:latest-release", "-log-output-dir", "/opt/selenoid/logs/", "-container-network", "selenoid" ], "Image": "aerokube/selenoid:1.10.0", "Volumes": null, "WorkingDir": "", "Entrypoint": [ "/usr/bin/selenoid", "-listen", ":4444", "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video/" ], "OnBuild": null, "Labels": {} }, "NetworkSettings": { "Bridge": "", "SandboxID": "277bfba1fa09f26d75de09196e4dbe6140b8d3ca60a1f3b3de167fa68533bb86", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "4444/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "4444" } ] }, "SandboxKey": "/var/run/docker/netns/277bfba1fa09", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "", "Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "", "IPPrefixLen": 0, "IPv6Gateway": "", "MacAddress": "", "Networks": { "selenoid": { "IPAMConfig": null, "Links": null, "Aliases": [ "1e16d7fbb2c5" ], "NetworkID": "72c56e6117e60488afc4a8705821e871e28a79acfc04c23249393b1113a40e69", "EndpointID": "d8b10b90baa55b350a64ea4f18e44b3604f24e7f49105d9b05dc954715d74cee", "Gateway": "172.18.0.1", "IPAddress": "172.18.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:12:00:02", "DriverOpts": null } } } } ]

andrei-kotau avatar Aug 29 '20 20:08 andrei-kotau

@iJSmile you should normally have browsers.json file in /home/jenkins/.aerokube/selenoid. If there is no such file - try to add --force flag to cm command.

vania-pooh avatar Aug 30 '20 06:08 vania-pooh

@vania-pooh I do have this file: cat /home/jenkins/.aerokube/selenoid/browsers.json { "chrome": { "default": "83.0", "versions": { "81.0": { "image": "selenoid/vnc_chrome:81.0", "port": "4444", "path": "/" }, "83.0": { "image": "selenoid/vnc_chrome:83.0", "port": "4444", "path": "/" } } }, "firefox": { "default": "77.0", "versions": { "76.0": { "image": "selenoid/vnc_firefox:76.0", "port": "4444", "path": "/wd/hub" }, "77.0": { "image": "selenoid/vnc_firefox:77.0", "port": "4444", "path": "/wd/hub" } } }, "opera": { "default": "68.0", "versions": { "67.0": { "image": "selenoid/vnc_opera:67.0", "port": "4444", "path": "/" }, "68.0": { "image": "selenoid/vnc_opera:68.0", "port": "4444", "path": "/" } } } }

andrei-kotau avatar Aug 30 '20 07:08 andrei-kotau

Is there browsers.json on jenkins slave where selenoid is running?

вс, 30 авг. 2020 г., 10:52 iJSmile [email protected]:

@vania-pooh https://github.com/vania-pooh I do have this file: cat /home/jenkins/.aerokube/selenoid/browsers.json { "chrome": { "default": "83.0", "versions": { "81.0": { "image": "selenoid/vnc_chrome:81.0", "port": "4444", "path": "/" }, "83.0": { "image": "selenoid/vnc_chrome:83.0", "port": "4444", "path": "/" } } }, "firefox": { "default": "77.0", "versions": { "76.0": { "image": "selenoid/vnc_firefox:76.0", "port": "4444", "path": "/wd/hub" }, "77.0": { "image": "selenoid/vnc_firefox:77.0", "port": "4444", "path": "/wd/hub" } } }, "opera": { "default": "68.0", "versions": { "67.0": { "image": "selenoid/vnc_opera:67.0", "port": "4444", "path": "/" }, "68.0": { "image": "selenoid/vnc_opera:68.0", "port": "4444", "path": "/" } } } }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aerokube/selenoid/issues/979#issuecomment-683388969, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKY23K6EKBKAVICQP7SBRLSDIALNANCNFSM4QPFSVAQ .

aandryashin avatar Aug 30 '20 09:08 aandryashin

@aandryashin yes, I've posted it's content above.

andrei-kotau avatar Aug 30 '20 12:08 andrei-kotau

I found out that, our Jenkins runs in the docker, and all slaves run in the docker too. So when I run cm, it appears I am trying to run docker inside a docker. Can this be an issue? Maybe this confuses cm utility and that's why it cannot figure out how to run all this stuff. Does anyone has experience in this field? Let me know I can provide some more details if needed ('cat' some files, show directory structure and so on).

andrei-kotau avatar Sep 03 '20 14:09 andrei-kotau

@iJSmile probably in that case CM starts a container outside of the filesystem where it creates configuration files. How about just starting Selenoid one time on every agent host manually?

vania-pooh avatar Sep 03 '20 14:09 vania-pooh

So you mean to run it in some way like this (as it described in the official documentation), right? docker run -d
--name selenoid
-p 4444:4444
-v /var/run/docker.sock:/var/run/docker.sock
-v pwd/config/:/etc/selenoid/:ro
aerokube/selenoid:latest-release

andrei-kotau avatar Sep 03 '20 15:09 andrei-kotau

@iJSmile you can use the same CM command but not inside the build steps.

vania-pooh avatar Sep 04 '20 04:09 vania-pooh

Hello, I'm having this very same issue... @iJSmile did you solve it? thanks in advance!

lgarelli-thefork avatar Dec 28 '20 20:12 lgarelli-thefork

@lgarelli-thefork you can print log of any Docker container (including Selenoid) using the following command:

$ docker logs selenoid

vania-pooh avatar Dec 29 '20 11:12 vania-pooh

I am also facing exactly the same issue , is there any update on this issue ? @lgarelli-thefork @vania-pooh

rakesh13121989 avatar Aug 06 '21 04:08 rakesh13121989

I am also facing the same issue , in docker logs I can see the error as " [/usr/bin/selenoid: browsers config: read error: open /etc/selenoid/browsers.json: no such file or directory]" . My volume mapping is "-v $PWD/config/:/etc/selenoid/:ro" . if I do "cat $PWD/config/browsers.json" , my browsers.json content is opened and same I can validate manually as well that file is present .

Below commands I am using . These commands I am executing directly through Jenkins . In My local same exact command is working fine , but in jenkins its giving error .

mkdir -p config

cat <<EOF >$PWD/config/browsers.json { "firefox": { "default": "57.0", "versions": { "57.0": { "image": "selenoid/firefox:90.0", "port": "4444", "path": "/wd/hub" }, "58.0": { "image": "selenoid/firefox:90.0", "port": "4444", "path": "/wd/hub" }, "59.0": { "image": "selenoid/firefox:90.0", "port": "4444", "path": "/wd/hub" } }

}

} EOF chmod +rwx $PWD/config/browsers.json cat $PWD/config/browsers.json docker pull aerokube/selenoid:latest docker pull aerokube/cm:latest docker pull aerokube/selenoid-ui:latest docker pull selenoid/video-recorder:latest-release docker pull selenoid/vnc_chrome:92.0 docker pull selenoid/vnc_firefox:90.0

docker stop selenoid ||true docker rm selenoid ||true

docker run -d --name selenoid -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock
-v $PWD/config/:/etc/selenoid/:ro aerokube/selenoid

rakesh13121989 avatar Aug 06 '21 05:08 rakesh13121989

@rakesh13121989 as I said on StackOverflow, there is an issue somewhere near $PWD environment variable. Also it makes no sense to start Selenoid with docker run command if you are using CM. We provide working CM binary that configures everything automatically with 1 command. If you prefer configuring everything manually, then it's your responsibility to read documentation thoroughly and overcome all possible issues.

vania-pooh avatar Aug 08 '21 04:08 vania-pooh

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 29 '24 01:01 github-actions[bot]