docs: add mitigation instructions non-root user not node #1278
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
If a Cypress Docker image is run with a non-root user other than the configured
node
(1000
) user, and if no additional measures are taken, multiple subsystems which rely on being able write into the Linux $HOME directory are unable to cache intermediate results. This causes Cypress to fail to run. The error message contains the text:Cypress Docker images (
cypress/base
,cypress/browsers
,cypress/included
& custom images generated fromcypress/factory
) include only ahome
directory for the non-root usernode
(1000
). This directory is owned by the usernode
and does not allow other users write access.Executing
npx cypress run
with usernode
or1000
sets$HOME
to/home/node
and creates the following directories in the$HOME
directory:Executing
npx cypress run
with any other non-root user such as1001
sets$HOME
to/
, which is owned byroot:root
with no write access given to any non-root user. This blocks the above directories from being created, which in turn causes Cypress to fail. The failure shown in the issue reproduction for #1275 relates to the failure to create the directory.cache/fontconfig
. Other users have reported other error messages, which stem from the same root cause of not be able to write to the directory specified by$HOME
.Mitigation
$HOME
environment variable to point to the existing/home/node
directory and allowing write access to all users mitigates the issue. The workaround described in EACCES permission denied binary_state.json forcypress/base
&cypress/browsers
which involves allowing write access to all users to/root/.cache/Cypress
can be combined for all images for simplicity of description.Change
Add a new topic to the README > Known problems section.
Suggest the workaround to add the following instructions to the
Dockerfile
when building a Cypress Docker image to be used with a non-root user other than the built-innode
(1000
) user:Verification
Ignore warning:
cypress/base
Create
examples/basic/Dockerfile.base.workaround_font
with the following contents:and execute the following:
cypress/browsers
Create
examples/basic/Dockerfile.browsers.workaround_font
with the following contents:and execute the following:
cypress/factory
Create
examples/basic-mini/Dockerfile.factory.workaround_font
with the following contents:and execute the following:
cypress/included
Create
examples/included-as-non-root/Dockerfile.included.workaround_font
with the following contents:and execute the following: