From 9f6bb8e4249062e455ffe1737da48896676df58a Mon Sep 17 00:00:00 2001 From: Artem Blazhievskii <123565843+ablzh@users.noreply.github.com> Date: Fri, 21 Aug 2026 14:53:09 +0800 Subject: [PATCH 1/3] Enhance README with Docker and Cuprite instructions Updated Docker usage instructions for Cuprite driver to include Ferrum's container mode and clarified the no-sandbox option usage. --- README.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c6b6e37..593fcd8 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,27 @@ Capybara.register_driver(:cuprite) do |app| end ``` -if you use `Docker` don't forget to pass `no-sandbox` option: +If Chrome cannot initialize its sandbox in Docker (for example, when the +container runs as `root`), pass the `no-sandbox` browser option explicitly: ```ruby -Capybara::Cuprite::Driver.new(app, browser_options: { 'no-sandbox': nil }) +Capybara::Cuprite::Driver.new(app, browser_options: { "no-sandbox" => nil }) ``` +Alternatively, use Ferrum's container mode: + +```ruby +Capybara::Cuprite::Driver.new(app, dockerize: true) +``` + +Cuprite passes these options to Ferrum. In Ferrum 0.17.2, `dockerize: true` +adds both `--no-sandbox` and `--disable-setuid-sandbox`; Ferrum also includes +`--disable-dev-shm-usage` in its default Chrome options. See Ferrum's +[`dockerize` implementation](https://github.com/rubycdp/ferrum/blob/v0.17.2/lib/ferrum/browser/options/chrome.rb#L92-L99) +and +[`DEFAULT_OPTIONS`](https://github.com/rubycdp/ferrum/blob/v0.17.2/lib/ferrum/browser/options/chrome.rb#L5-L18). +Use either `dockerize: true` or the explicit `no-sandbox` option, not both. + Since Cuprite uses [Ferrum](https://github.com/rubycdp/ferrum#examples) there are many useful methods you can call even using this driver: From df32fc2be12013b3d7768a90fc301a002004393e Mon Sep 17 00:00:00 2001 From: Artem Blazhievskii <123565843+ablzh@users.noreply.github.com> Date: Fri, 21 Aug 2026 15:18:28 +0800 Subject: [PATCH 2/3] Revise Docker Chrome setup instructions Updated instructions for using Chrome in Docker with Cuprite, emphasizing Ferrum's container mode and removing redundant options. --- README.md | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 593fcd8..7963778 100644 --- a/README.md +++ b/README.md @@ -27,26 +27,16 @@ Capybara.register_driver(:cuprite) do |app| end ``` -If Chrome cannot initialize its sandbox in Docker (for example, when the -container runs as `root`), pass the `no-sandbox` browser option explicitly: - -```ruby -Capybara::Cuprite::Driver.new(app, browser_options: { "no-sandbox" => nil }) -``` - -Alternatively, use Ferrum's container mode: +If Chrome cannot use its sandbox inside a container—for example, because it +runs as `root`—enable Ferrum's container mode: ```ruby Capybara::Cuprite::Driver.new(app, dockerize: true) ``` -Cuprite passes these options to Ferrum. In Ferrum 0.17.2, `dockerize: true` -adds both `--no-sandbox` and `--disable-setuid-sandbox`; Ferrum also includes -`--disable-dev-shm-usage` in its default Chrome options. See Ferrum's -[`dockerize` implementation](https://github.com/rubycdp/ferrum/blob/v0.17.2/lib/ferrum/browser/options/chrome.rb#L92-L99) -and -[`DEFAULT_OPTIONS`](https://github.com/rubycdp/ferrum/blob/v0.17.2/lib/ferrum/browser/options/chrome.rb#L5-L18). -Use either `dockerize: true` or the explicit `no-sandbox` option, not both. +This disables Chrome's sandbox, so do not enable it merely because Docker is +used. Prefer running Chrome as a non-root user with a working sandbox when +possible. Since Cuprite uses [Ferrum](https://github.com/rubycdp/ferrum#examples) there are many useful methods you can call even using this driver: From d10a1d7ac1a79ee0eaf8666dab13f8b0d1df30ef Mon Sep 17 00:00:00 2001 From: Artem Blazhievskii <123565843+ablzh@users.noreply.github.com> Date: Fri, 21 Aug 2026 15:25:21 +0800 Subject: [PATCH 3/3] Update README with Ferrum container mode details Clarify usage of Ferrum's container mode and browser options. --- README.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7963778..91854cf 100644 --- a/README.md +++ b/README.md @@ -27,16 +27,26 @@ Capybara.register_driver(:cuprite) do |app| end ``` -If Chrome cannot use its sandbox inside a container—for example, because it -runs as `root`—enable Ferrum's container mode: +If Chrome or Chromium cannot use its sandbox inside a container—for example, +because it runs as `root`—enable Ferrum's container mode: ```ruby Capybara::Cuprite::Driver.new(app, dockerize: true) ``` -This disables Chrome's sandbox, so do not enable it merely because Docker is -used. Prefer running Chrome as a non-root user with a working sandbox when -possible. +The `dockerize` option requires Ferrum 0.17.2 or newer. With an older Ferrum +version, pass the browser option explicitly: + +```ruby +Capybara::Cuprite::Driver.new( + app, + browser_options: { "no-sandbox" => nil } +) +``` + +Both approaches disable the browser's sandbox, so do not use them merely +because Docker is involved. Prefer running the browser as a non-root user with +a working sandbox when possible. Since Cuprite uses [Ferrum](https://github.com/rubycdp/ferrum#examples) there are many useful methods you can call even using this driver: