jlesage / docker-firefox

Docker container for Firefox
MIT License
1.42k stars 267 forks source link

Black Screen #152

Closed Freshhat closed 1 year ago

Freshhat commented 1 year ago

Currently i'm a little bit lost, after restarting the container i'm just getting a black screen. I can still see the cursor and also the clipboard menu, but nothing is loaded.

docker-compose:

# Firefox
    firefox:
      image: jlesage/firefox
      container_name: firefox
      volumes:
        - "/home/xx/docker/firefox:/config:rw"
      shm_size: '4g'
      environment:
        - KEEP_APP_RUNNING=1
        - DARK_MODE=1
        - SECURE_CONNECTION=1
        - CLEAN_TMP_DIR=1
      security_opt:
        - seccomp:unconfined
      ports:
        - 5801:5800
        - 5900:5900
      privileged: true
      restart: always

docker logs output:

[init        ] container is starting...
[cont-env    ] loading container environment variables...
[cont-env    ] APP_NAME: loading...
[cont-env    ] APP_VERSION: loading...
[cont-env    ] DISPLAY: executing...
[cont-env    ] DISPLAY: terminated successfully.
[cont-env    ] DISPLAY: loading...
[cont-env    ] DOCKER_IMAGE_PLATFORM: loading...
[cont-env    ] DOCKER_IMAGE_VERSION: loading...
[cont-env    ] GTK_THEME: executing...
[cont-env    ] GTK_THEME: terminated successfully.
[cont-env    ] GTK_THEME: loading...
[cont-env    ] HOME: loading...
[cont-env    ] QT_STYLE_OVERRIDE: executing...
[cont-env    ] QT_STYLE_OVERRIDE: terminated successfully.
[cont-env    ] QT_STYLE_OVERRIDE: loading...
[cont-env    ] TAKE_CONFIG_OWNERSHIP: loading...
[cont-env    ] XDG_CACHE_HOME: loading...
[cont-env    ] XDG_CONFIG_HOME: loading...
[cont-env    ] XDG_DATA_HOME: loading...
[cont-env    ] XDG_RUNTIME_DIR: loading...
[cont-env    ] container environment variables initialized.
[cont-secrets] loading container secrets...
[cont-secrets] container secrets loaded.
[cont-init   ] executing container initialization scripts...
[cont-init   ] 10-certs.sh: executing...
[cont-init   ] 10-certs.sh: generating DH parameters (2048 bits), this is going to take a long time...
[cont-init   ] 10-certs.sh: generating self-signed certificate for WEB server...
[cont-init   ] 10-certs.sh: generating self-signed certificate for VNC server...
[cont-init   ] 10-certs.sh: terminated successfully.
[cont-init   ] 10-check-app-niceness.sh: executing...
[cont-init   ] 10-check-app-niceness.sh: terminated successfully.
[cont-init   ] 10-cjk-font.sh: executing...
[cont-init   ] 10-cjk-font.sh: terminated successfully.
[cont-init   ] 10-clean-logmonitor-states.sh: executing...
[cont-init   ] 10-clean-logmonitor-states.sh: terminated successfully.
[cont-init   ] 10-clean-tmp-dir.sh: executing...
[cont-init   ] 10-clean-tmp-dir.sh: terminated successfully.
[cont-init   ] 10-fontconfig-cache-dir.sh: executing...
[cont-init   ] 10-fontconfig-cache-dir.sh: terminated successfully.
[cont-init   ] 10-init-users.sh: executing...
[cont-init   ] 10-init-users.sh: terminated successfully.
[cont-init   ] 10-jwm.sh: executing...
[cont-init   ] 10-jwm.sh: terminated successfully.
[cont-init   ] 10-nginx.sh: executing...
[cont-init   ] 10-nginx.sh: terminated successfully.
[cont-init   ] 10-set-tmp-dir-perms.sh: executing...
[cont-init   ] 10-set-tmp-dir-perms.sh: terminated successfully.
[cont-init   ] 10-vnc-password.sh: executing...
[cont-init   ] 10-vnc-password.sh: terminated successfully.
[cont-init   ] 10-web-data.sh: executing...
[cont-init   ] 10-web-data.sh: terminated successfully.
[cont-init   ] 10-x11-unix.sh: executing...
[cont-init   ] 10-x11-unix.sh: terminated successfully.
[cont-init   ] 10-xdg-runtime-dir.sh: executing...
[cont-init   ] 10-xdg-runtime-dir.sh: terminated successfully.
[cont-init   ] 15-install-pkgs.sh: executing...
[cont-init   ] 15-install-pkgs.sh: terminated successfully.
[cont-init   ] 55-check-snd.sh: executing...
[cont-init   ] 55-check-snd.sh: sound device group 63.
[cont-init   ] 55-check-snd.sh: terminated successfully.
[cont-init   ] 55-firefox.sh: executing...
[cont-init   ] 55-firefox.sh: generating machine-id...
[cont-init   ] 55-firefox.sh: terminated successfully.
[cont-init   ] 56-firefox-set-prefs-from-env.sh: executing...
[cont-init   ] 56-firefox-set-prefs-from-env.sh: terminated successfully.
[cont-init   ] 85-take-config-ownership.sh: executing...
[cont-init   ] 85-take-config-ownership.sh: terminated successfully.
[cont-init   ] 89-info.sh: executing...
    ╭――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――╮
    │                                                                      │
    │ Application:           Firefox                                       │
    │ Application Version:   107.0.1-r1                                    │
    │ Docker Image Version:  22.12.2                                       │
    │ Docker Image Platform: linux/amd64                                   │
    │                                                                      │
    ╰――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――╯
[cont-init   ] 89-info.sh: terminated successfully.
[cont-init   ] all container initialization scripts executed.
[init        ] giving control to process supervisor.
[supervisor  ] loading services...
[supervisor  ] loading service 'default'...
[supervisor  ] loading service 'app'...
[supervisor  ] loading service 'gui'...
[supervisor  ] loading service 'certsmonitor'...
[supervisor  ] loading service 'jwm'...
[supervisor  ] loading service 'xvnc'...
[supervisor  ] loading service 'nginx'...
[supervisor  ] loading service 'logmonitor'...
[supervisor  ] all services loaded.
[supervisor  ] starting services...
[supervisor  ] starting service 'xvnc'...
[xvnc        ] Xvnc TigerVNC 1.12.0 - built Dec 11 2022 21:12:05
[xvnc        ] Copyright (C) 1999-2021 TigerVNC Team and many others (see README.rst)
[xvnc        ] See https://www.tigervnc.org for information on TigerVNC.
[xvnc        ] Underlying X server release 12013000, The X.Org Foundation
[xvnc        ] Wed Dec 28 13:44:33 2022
[xvnc        ]  vncext:      VNC extension running!
[xvnc        ]  vncext:      Listening for VNC connections on /tmp/vnc.sock (mode 0660)
[xvnc        ]  vncext:      created VNC server for screen 0
[supervisor  ] starting service 'jwm'...
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[supervisor  ] starting service 'app'...
[app         ] Mozilla Firefox 107.0.1
[supervisor  ] starting service 'logmonitor'...
[logmonitor  ] Monitoring log file: /config/log/firefox/error.log
[logmonitor  ] Monitoring status file: /tmp/.firefox_shm_check
[logmonitor  ] Monitoring status file: /tmp/.firefox_membarrier_check
[supervisor  ] all services started.
[xvnc        ] Wed Dec 28 13:44:42 2022
[xvnc        ]  Connections: accepted: /tmp/vnc.sock
[xvnc        ]  SConnection: Client needs protocol version 3.8
[xvnc        ]  SConnection: Client requests security type None(1)
[xvnc        ]  VNCSConnST:  Server default pixel format depth 24 (32bpp) little-endian rgb888
[xvnc        ]  VNCSConnST:  Client pixel format depth 24 (32bpp) little-endian bgr888
[xvnc        ] Wed Dec 28 13:44:43 2022
[xvnc        ]  ComparingUpdateTracker: 0 pixels in / 0 pixels out
[xvnc        ]  ComparingUpdateTracker: (1:-nan ratio)

Screenshot WebApp: image

Is there any other log, which i can provide?

Freshhat commented 1 year ago

Ok seems i figured out the issue, it's about time. The Firefox app itself needs about 30 min to start completley. Is there anything to improve this? With the last versions it took a few seconds only when i restarted the container

jlesage commented 1 year ago

Is this issue seen every time the container starts?

Freshhat commented 1 year ago

Yep unfortunatley after every docker restart or even after a complete recreate via docker-compose. This happens also if i start with a fresh profile (removing the config volume and start with a empty one)

jlesage commented 1 year ago

Also, on which system are you running the container ?

Freshhat commented 1 year ago

Also, on which system are you running the container ?

I'm running it on Fedora Server 35, running with docker version 20.10.22

bcvb2001 commented 1 year ago

I have the same problem. Do I need to wait for 30 minutes to start docker Standalone 20.10.17

linuxhd0 commented 1 year ago

I ran strace on the firefox process and found that it was wasting CPU and time trying to close a lot of file descriptors. Seems to be related to this issue: https://github.com/moby/moby/issues/44547

Specifying the ulimits for the container in my docker compose file solved the problem for me:

    ulimits:
      nofile:
        soft: 65536
        hard: 65536
Freshhat commented 1 year ago

I ran strace on the firefox process and found that it was wasting CPU and time trying to close a lot of file descriptors. Seems to be related to this issue: moby/moby#44547

Specifying the ulimits for the container in my docker compose file solved the problem for me:

    ulimits:
      nofile:
        soft: 65536
        hard: 65536

Thanks, this also solved it on my side. I can life with that option in my compose file. So from my perspective we can close this

jlesage commented 1 year ago

Thanks for all the info. With the latest image, it should work without setting ulimits in your compose file.