jlandure / alpine-chrome

Chrome Headless docker images built upon alpine official image
https://hub.docker.com/r/zenika/alpine-chrome
Apache License 2.0
1.89k stars 245 forks source link

crashes right away #190

Closed matti closed 2 years ago

matti commented 2 years ago
$ docker container run -it --rm zenika/alpine-chrome
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
[1223/161300.469440:FATAL:zygote_host_impl_linux.cc(191)] Check failed: ReceiveFixedMessage(fds[0], kZygoteBootMessage, sizeof(kZygoteBootMessage), &boot_pid).
Received signal 6
  r8: 00007ffdc463ccf0  r9: 00007fec627bbf6c r10: 0000000000000008 r11: 0000000000000246
 r12: 00007ffdc463d320 r13: 00000000000000a0 r14: 00007fec60bf9d10 r15: 00007fec638f9bd0
  di: 0000000000000002  si: 00007ffdc463cba0  bp: 00007ffdc463cba0  bx: 0000000000000000
  dx: 0000000000000000  ax: 0000000000000000  cx: 00007fec661873b2  sp: 00007ffdc463cb98
  ip: 00007fec661873b2 efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
 trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.
matti commented 2 years ago

also:

$ docker container run -it --rm --cap-add=SYS_ADMIN zenika/alpine-chrome
[1223/161430.473823:WARNING:headless_content_main_delegate.cc(530)] Cannot create Pref Service with no user data dir.
[1223/161430.534147:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[1223/161430.534311:WARNING:dns_config_service_posix.cc(291)] Failed to read DnsConfig.
[1223/161430.553400:ERROR:vaapi_wrapper.cc(573)] Could not get a valid VA display
[1223/161430.618664:WARNING:dns_config_service_posix.cc(291)] Failed to read DnsConfig.
matti commented 2 years ago

and also

$ docker container run -it --rm --security-opt seccomp=$(pwd)/chrome.json zenika/alpine-chrome
[1223/161833.964355:WARNING:headless_content_main_delegate.cc(530)] Cannot create Pref Service with no user data dir.
[1223/161834.001579:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[1223/161834.003209:WARNING:dns_config_service_posix.cc(291)] Failed to read DnsConfig.
[1223/161834.017905:ERROR:vaapi_wrapper.cc(573)] Could not get a valid VA display

I have a feeling that this has something to do with latest docker:

$ docker -v
Docker version 20.10.11, build dea9396
pplotka commented 2 years ago

Hi! I have the same problem.

anirudh-mehta commented 2 years ago

For headless mode (default), you should pass the command or attach debugger.

docker container run -it --rm zenika/alpine-chrome --no-sandbox --dump-dom https://www.google.com

or

docker container run -p9222:9222 -it --rm zenika/alpine-chrome --no-sandbox --remote-debugging-address=0.0.0.0 --remote-debugging-port=9222 https://www.google.com

Visit localhost:9222 in browser
suntong commented 2 years ago

Thanks @anirudh-mehta, that works.

Such "hard" requirement should be put into the Dockerfile file instead (the --no-sandbox), IMHO.

hgwood commented 2 years ago

See the readme for instructions on this.