{"id":15080589,"url":"https://github.com/socrateslee/xvfb-chrome","last_synced_at":"2025-10-30T23:14:11.695Z","repository":{"id":247196985,"uuid":"825228289","full_name":"socrateslee/xvfb-chrome","owner":"socrateslee","description":"A chrome docker image with virtual desktop(xvfb/wayland) support","archived":false,"fork":false,"pushed_at":"2024-07-21T16:11:48.000Z","size":8,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-27T12:13:06.368Z","etag":null,"topics":["chrome","docker"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/socrateslee/xvfb-chrome","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/socrateslee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-07T07:20:49.000Z","updated_at":"2025-07-09T06:54:19.000Z","dependencies_parsed_at":"2024-09-29T17:10:31.153Z","dependency_job_id":null,"html_url":"https://github.com/socrateslee/xvfb-chrome","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"22ba741bc91e183c191e2f8d7b5ecd1a213aceb1"},"previous_names":["socrateslee/xvfb-chrome"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/socrateslee/xvfb-chrome","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socrateslee%2Fxvfb-chrome","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socrateslee%2Fxvfb-chrome/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socrateslee%2Fxvfb-chrome/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socrateslee%2Fxvfb-chrome/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/socrateslee","download_url":"https://codeload.github.com/socrateslee/xvfb-chrome/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socrateslee%2Fxvfb-chrome/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281896747,"owners_count":26580176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-30T02:00:06.501Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chrome","docker"],"created_at":"2024-09-25T05:02:12.304Z","updated_at":"2025-10-30T23:14:11.672Z","avatar_url":"https://github.com/socrateslee.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xvfb-chrome\n\nA chrome docker image with virtual desktop(xvfb/wayland) support.\n\nPull the image by\n\n```\ndocker pull socrateslee/xvfb-chrome\n```\n\nThe image solve several problems:\n\n- Map chrome `--remote-debugging-port` to host.\n- Support run chrome with non-root user chrome(no `--no-sandbox` required to run chrome).\n- Support run chrome using virtual desktop with both xvfb and wayland.\n- Reduce the occurences of `open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)` error.\n\n## Usage\n\n- Start a headless chrome:\n\n```\nsudo docker run --rm -it \\\n                -v $(pwd):/workdir --workdir /workdir \\\n                --cap-add=SYS_ADMIN \\\n                socrateslee/xvfb-chrome:latest\\\n                --headless \u003cURL\u003e\n```\n\nNote that `--cap-add=SYS_ADMIN` is needed to run chrome with a non-root user.\n\n- Start chrome using xvfb-run and specifiy the `--remote-debugging-port`:\n\n```\nsudo docker run --rm -it \\\n                -v $(pwd):/workdir --workdir /workdir \\\n                --cap-add=SYS_ADMIN \\\n                -p 9222:9222 \\\n                socrateslee/xvfb-chrome:latest\\\n                --xvfb-run --remote-debugging-port=9222\n```\n\nNote that `-p 9222:9222` is for exposing `\u003cDOCKER_CONTAINER_IP\u003e:9222` to host 9222 port. You can always start a cdp connection to `\u003cDOCKER_CONTAINER_IP\u003e:9222` without `-p`.\n\n- Start chorme using wayland:\n\n```\nsudo docker run --rm -it \\\n                -v $(pwd):/workdir --workdir /workdir \\\n                --cap-add=SYS_ADMIN \\\n                -p 9222:9222 \\\n                socrateslee/xvfb-chrome:latest\\\n                --wayland --remote-debugging-port=9222 --disable-gpu\n```\n- Map fonts directory to container(you can download fonts to \\\u003cYOUR_FONTS_DIR\\\u003e):\n\n```\nsudo docker run --rm -it \\\n                -v \u003cYOUR_FONTS_DIR\u003e:/home/chrome/.fonts \\\n                -v $(pwd):/workdir --workdir /workdir \\\n                --cap-add=SYS_ADMIN \\\n                -p 9222:9222 \\\n                socrateslee/xvfb-chrome:latest\\\n                --headless=new --print-to-pdf \u003cURL\u003e\n```\n\n## Entrypoint script options\n\nThe entrypoint script(`/usr/local/bin/chrome.sh`) support several special options:\n\n- `--xvfb-run`: Start chrome using xvfb-run.\n- `--wayland`: Start chrome using wayland. Will add --enable-features=UseOzonePlatform and --ozone-platform=wayland to chrome command line.\n- `--remote-debugging-port=\u003cport\u003e`: The option is passed to chrome command line. But the entrypoint script will also fork a socat process to map the port from 127.0.0.1 to 0.0.0.0. So you can always connect to the port from host.\n- `--dbus` Start a dbus daemon process.\n\nOther options are passed to chrome command line.\n\n## Note on cpufreq/scaling_cur_freq error\n\nSometimes the running container may occur the following error and chrome process will hang:\n\n```\n[0707/070947.640825:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)\n[0707/070947.640877:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)\n```\n\nIn most of the cases, the error is caused by limited space of /dev/shm, the error could be avoided by appending `--disable-dev-shm-usage`. For example\n\n```\nsudo docker run --rm -it \\\n                -v $(pwd):/workdir --workdir /workdir \\\n                --cap-add=SYS_ADMIN \\\n                -p 9222:9222 \\\n                socrateslee/xvfb-chrome:latest\\\n                --xvfb-run --remote-debugging-port=9222 --disable-dev-shm-usage\n```\n\nFor other cases, the following method may help reduce the occurences of the error:\n\n- Using `--wayland` option and append `--disable-gpu`.\n- Append `--disable-blink-features=ComputePressure`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocrateslee%2Fxvfb-chrome","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocrateslee%2Fxvfb-chrome","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocrateslee%2Fxvfb-chrome/lists"}